# -*- coding: UTF-8 -*-
import platform
#print(platform.system())#c查看系统
if(int(platform.python_version()[0])==2):#python2
    from Tkinter import *
    import ttk
    from tkinter import filedialog
    from tkinter import messagebox
else:#python3
    from tkinter import *
    import ttk
    from tkinter import filedialog
    from tkinter import messagebox

import time
import threading
import sys
import os
import calendar
import traceback
import random
################################################################
#self
from dianbiao_serial_protocol import *
from dianbiao_serial_deal   import *
import dianbiao_logic
#ser=serial.Serial("/dev/ttyUSB0",9600,timeout=0.5)
##################################################################
#traceback demo
#def func1():
#    raise NameError("--func1 exception--")


#def main():
#    try:
#        func1()
#    except Exception as e:
#        exc_type, exc_value, exc_traceback_obj = sys.exc_info()
#        traceback.print_tb(exc_traceback_obj)
###################################################################
#单电表 数量 one_one_num 地址 one_one_address
#三相三线电表 数量 tree_tree_num 地址 tree_tree_address
#三相四线电表 数量 tree_four_num 地址 tree_four_address
#冻结数据     方式 cold_way     cold_way_data
#费率         feilv_time_1 feilv_time_1_way
#feilv_time_2 feilv_time_2_way
#feilv_time_3 feilv_time_3_way
#.............
#feilv_time_15 feilv_time_15_way
#配置文件的保存
#object_pwd
#feilv_pwd
#cold_pwd
class Dianbiao_view():
    def __init__(self):
        ######################配置数据##################
        self.config_data={}
        self.dianbiao_data_config_read()
        threading.stack_size(10 * 1024 * 1024)
        #########################主框#############################
        self.root = Tk()
        self.root.resizable(False, False)  # 固定大小
        self.root.title("Show View")

        self.mainframe2 = ttk.Frame(self.root, padding="10 10 10 10")
        self.mainframe2.grid(column=0, row=0, sticky=(N, W, E, S))
        #self.mainframe2.pack(expand=1)

        self.mainframe = ttk.Frame(self.root, padding="10 10 10 10")
        self.mainframe.grid(column=0, row=1, sticky=(N, W, E, S))
        #self.mainframe.pack(expand=1)
        ###############menu config################################
        self.menu_new_name_stringvar = None
        self.menu_new_dir_stringvar = None
        self.menu_edit_dir_string = ""
        self.toplevel_tmp = None
        menubar_tmp=Menu(self.root)
        ########################menu 费表###########################
        self.feilv_Combobox_list = None
        self.feilv_Entry_list = None

        feilv_config_menu_tmp=Menu(menubar_tmp,tearoff=False)
        feilv_config_menu_tmp.add_separator()
        feilv_config_menu_tmp.add_command(label=u"新建费率配置文件",command=self.dianbiao_feilv_config_new_menu)
        feilv_config_menu_tmp.add_command(label=u"编辑费率配置文件", command=self.dianbiao_feilv_config_edit_menu)
        feilv_config_menu_tmp.add_separator()
        menubar_tmp.add_cascade(label=u"费率配置",menu=feilv_config_menu_tmp)
        ########################menu 冻结数据配置##############################
        self.cold_data = None
        self.cold_data_combox = None
        self.cold_data_way_tuple = (u"无特别要求", u"定时冻结", u"整点冻结", u"分钟冻结")

        #cold_data_config_menu_tmp = Menu(menubar_tmp, tearoff=False)
        #cold_data_config_menu_tmp.add_separator()
        #cold_data_config_menu_tmp.add_command(label=u"新建冻结配置文件", command=self.dianbiao_cold_data_config_new_menu)
        #cold_data_config_menu_tmp.add_command(label=u"编辑冻结配置文件", command=self.dianbiao_cold_data_config_edit_menu)
        #cold_data_config_menu_tmp.add_separator()
        #menubar_tmp.add_cascade(label=u"冻结配置", menu=cold_data_config_menu_tmp)
        ########################menu 电表总数和地址##############################
        self.all_num1_stringvar = None
        self.address_start1_stringvar = None

        self.all_num2_stringvar = None
        self.address_start2_stringvar = None

        self.all_num3_stringvar = None
        self.address_start3_stringvar = None

        self.dianbiao_feilv_pwd_stringvar = None
        self.dianbiao_cold_pwd_stringvar = None

        dianbiao_config_menu_tmp = Menu(menubar_tmp, tearoff=False)
        dianbiao_config_menu_tmp.add_separator()
        dianbiao_config_menu_tmp.add_command(label=u"新建电表配置文件", command=self.dianbiao_object_config_new_menu)
        dianbiao_config_menu_tmp.add_command(label=u"编辑电表配置文件", command=self.dianbiao_object_config_edit_menu)
        dianbiao_config_menu_tmp.add_separator()
        menubar_tmp.add_cascade(label=u"电表相关配置", menu=dianbiao_config_menu_tmp)
        ########################电表运行##############################
        self.dianbiao_object_run_flag = 0
        self.dianbiao_object_pwd_stringvar=None
        self.root.config(menu=menubar_tmp)
        menubar_tmp.add_command(label=u"电表运行配置", command=self.dianbiao_runing_put_show)
        ########################串口配置##############################
        self.serial_port_list = []
        self.serial_port_list_string = []
        for i in range(16):
            self.serial_port_list.append(None)
            self.serial_port_list_string.append(None)
        for i in range(16):
            thread_tmp = threading.Thread(target=self.dianbiao_serial_thread_function, args=(i,))
            thread_tmp.daemon = True
            thread_tmp.start()

        self.serial_button_functiion_list = []  # 按键打开的功能
        self.serial_button_functiion_list.append(self.dianbiao_serial1_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial2_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial3_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial4_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial5_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial6_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial7_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial8_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial9_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial10_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial11_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial12_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial13_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial14_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial15_button_function)
        self.serial_button_functiion_list.append(self.dianbiao_serial16_button_function)

        self.serial_Labe_list = []
        self.serial_Combobox_list = []
        self.serial_button_list = []

        self.root.config(menu=menubar_tmp)
        menubar_tmp.add_command(label=u"串口配置", command=self.dianbiao_serial_config_put_show)
        ########################menu 查询##############################

        self.dianbiao_result_address_Entry=None
        self.dianbiao_result_tree_view = None
        self.dianbiao_result_show_tree_view = None

        self.dianbiao_result_node1 = None
        self.dianbiao_result_node2 = None
        self.dianbiao_result_node3 = None
        self.dianbiao_result_node4 = None
        self.dianbiao_result_node5 = None

        self.dianbiao_result_flag1 = 0
        self.dianbiao_result_flag2 = 0
        self.dianbiao_result_flag3 = 0

        self.show_result_entry_tk = None
        self.menu_mouse_show = None


        self.root.config(menu=menubar_tmp)
        menubar_tmp.add_command(label=u"查询电表数据", command=self.dianbiao_result_put_show)
        #######################电表线程参数#######################################################
        self.one_one_switch_object_list = []
        self.tree_tree_switch_object_list = []
        self.tree_four_switch_object_list = []
        self.one_one_thread   = None
        self.tree_tree_thread = None
        self.tree_four_thread = None
        ################数据显示############################################
        self.show_Entry=StringVar()           #地址显示
        self.show_time_Label = StringVar()    # 时间显示
        self.show_feilv_Label= StringVar()    #费率显示

        #self.show_data11_Label = StringVar()  #正向有功
        #self.show_data12_Label = StringVar()  #反向有功
        #self.show_data13_Label = StringVar()  #第一象限无功
        #self.show_data14_Label = StringVar()  #第二象限无功
        #self.show_data15_Label = StringVar()  # 第三象限无功
        #self.show_data16_Label = StringVar()  # 第四象限无功

        #self.show_data21_Label = StringVar()  #正向有功
        #self.show_data22_Label = StringVar()  #反向有功
        #self.show_data23_Label = StringVar()  #第一象限无功
        #self.show_data24_Label = StringVar()  #第二象限无功
        #self.show_data25_Label = StringVar()  # 第三象限无功
        #self.show_data26_Label = StringVar()  # 第四象限无功

        self.show_data31_Label = StringVar()
        self.show_data32_Label = StringVar()
        self.show_data33_Label = StringVar()
        self.show_data34_Label = StringVar()
        self.show_data35_Label = StringVar()
        self.show_data36_Label = StringVar()

        self.show_data41_Label = StringVar()
        self.show_data42_Label = StringVar()
        self.show_data45_Label = StringVar()
        self.show_data46_Label = StringVar()
        self.show_data47_Label = StringVar()
        self.show_data48_Label = StringVar()
        #self.show_data49_Label = StringVar()
        #self.show_data4a_Label = StringVar()

        self.show_biao_Label_flag=0
        self.show_biao_Label=None

        #########################################################
        self.menu_mouse = Menu(self.root,
                               tearoff=False,
                               # bg="black",
                               )
        self.menu_mouse.add_command(label="剪切", command=self.mouse_cut_main)
        self.menu_mouse.add_command(label="复制", command=self.mouse_copy_main)
        self.menu_mouse.add_command(label="粘贴", command=self.mouse_paste_main)
        self.show_entry_tk=None
        ############################################################
        self.dianbiao_show_config(column_tmp=0, row_tmp=0, mainframe=self.mainframe,mainframe2=self.mainframe2,
                                  show_address_Entry=self.show_Entry,
                                  show_time_Label=self.show_time_Label,show_feilv_Label=self.show_feilv_Label,
                                  #show_data11_Label=self.show_data11_Label,show_data12_Label=self.show_data12_Label,
                                  #show_data13_Label=self.show_data13_Label, show_data14_Label=self.show_data14_Label,
                                  #show_data15_Label=self.show_data15_Label, show_data16_Label=self.show_data16_Label,
                                  #show_data21_Label=self.show_data21_Label, show_data22_Label=self.show_data22_Label,
                                  #show_data23_Label=self.show_data23_Label, show_data24_Label=self.show_data24_Label,
                                  #show_data25_Label=self.show_data25_Label, show_data26_Label=self.show_data26_Label,
                                  show_data31_Label=self.show_data31_Label, show_data32_Label=self.show_data32_Label,
                                  show_data33_Label=self.show_data33_Label, show_data34_Label=self.show_data34_Label,
                                  show_data35_Label=self.show_data35_Label, show_data36_Label=self.show_data36_Label,
                                  show_data41_Label=self.show_data41_Label, show_data42_Label=self.show_data41_Label,
                                  show_data45_Label=self.show_data45_Label, show_data46_Label=self.show_data46_Label,
                                  show_data47_Label=self.show_data47_Label, show_data48_Label=self.show_data48_Label,
                                  #show_data49_Label=self.show_data49_Label, show_data4a_Label=self.show_data4a_Label
                                 )
        ###############串口显示############################################


        ###############全部加上间隔###########################################
        for child in self.mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)
        for child in self.mainframe2.winfo_children():
            child.grid_configure(padx=5, pady=5)
        #######################show线程参数#####################
        self.show_thread_flag = 0
    ########################mouse_function###############################
    def mouse_cut_main(self,event=None):
        #print("None")
        if(self.show_entry_tk!=None):
            self.show_entry_tk.event_generate('<<Cut>>')

    def mouse_copy_main(self,event=None):
        if (self.show_entry_tk!=None):
            self.show_entry_tk.event_generate('<<Copy>>')

    def mouse_paste_main(self,event=None):
        if (self.show_entry_tk!=None):
            self.show_entry_tk.event_generate('<<Paste>>')

    def mouse_popup_main(self,event):
        self.menu_mouse.post(event.x_root, event.y_root)  # post在指定的位置显示弹出菜单

    def mouse_cut_show(self,event=None):
        if(self.show_result_entry_tk!=None):
            self.show_result_entry_tk.event_generate('<<Cut>>')

    def mouse_copy_show(self,event=None):
        if (self.show_result_entry_tk!=None):
            self.show_result_entry_tk.event_generate('<<Copy>>')

    def mouse_paste_show(self,event=None):
        if (self.show_result_entry_tk!=None):
            self.show_result_entry_tk.event_generate('<<Paste>>')

    def mouse_popup_show(self,event):
        self.menu_mouse_show.post(event.x_root, event.y_root)  # post在指定的位置显示弹出菜单
    ###############UI function############################################
    # 保留多少小数点
    #
    def num_format_str(self,data_tmp, bit_len):
        #保留多少小数
        str_tmp = format(data_tmp, "." + str(bit_len) + "f")
        return (str_tmp)

    def dianbiao_ui_object_select_button(self):
        string_tmp = filedialog.askopenfilename(title=u'打开配置文件', filetypes=[('json', '*.json'), ('All Files', '*')])
        if (len(string_tmp)):
            self.dianbiao_object_pwd_stringvar.set(string_tmp)
            self.dianbiao_data_config_write()

    def dianbiao_ui_feilv_select_button(self):
        string_tmp = filedialog.askopenfilename(title=u'打开配置文件', filetypes=[('json', '*.json'), ('All Files', '*')])
        if (len(string_tmp)):
            self.dianbiao_feilv_pwd_stringvar.set(string_tmp)

    def dianbiao_ui_cold_select_button(self):
        string_tmp = filedialog.askopenfilename(title=u'打开配置文件', filetypes=[('json', '*.json'), ('All Files', '*')])
        if (len(string_tmp)):
            self.dianbiao_cold_pwd_stringvar.set(string_tmp)

    ###############menu function###########################################
    def dianbiao_menu_delete_window(self):
        self.root.deiconify()#显示
        self.toplevel_tmp.destroy()
        self.toplevel_tmp=None

        #参数全部清除
        del (self.feilv_Combobox_list)
        del (self.feilv_Entry_list)

        self.feilv_Combobox_list = None
        self.feilv_Entry_list = None

        del (self.all_num1_stringvar)
        del (self.address_start1_stringvar)
        self.all_num1_stringvar = None
        self.address_start1_stringvar = None

        del (self.all_num2_stringvar)
        del (self.address_start2_stringvar)
        self.all_num2_stringvar = None
        self.address_start2_stringvar = None

        del (self.all_num3_stringvar)
        del (self.address_start3_stringvar)
        self.all_num3_stringvar = None
        self.address_start3_stringvar = None

        del (self.cold_data)
        del (self.cold_data_combox)
        self.cold_data = None
        self.cold_data_combox = None

        del (self.dianbiao_feilv_pwd_stringvar)
        del (self.dianbiao_cold_pwd_stringvar)
        self.dianbiao_feilv_pwd_stringvar = None
        self.dianbiao_cold_pwd_stringvar = None

        del(self.dianbiao_object_pwd_stringvar)
        self.dianbiao_object_pwd_stringvar = None

        del(self.serial_Labe_list)
        del (self.serial_Combobox_list)
        del (self.serial_button_list)
        self.serial_Labe_list = []
        self.serial_Combobox_list = []
        self.serial_button_list = []

        del (self.dianbiao_result_address_Entry)

        del (self.dianbiao_result_tree_view)
        del (self.dianbiao_result_show_tree_view)

        del (self.dianbiao_result_node1)
        del (self.dianbiao_result_node2)
        del (self.dianbiao_result_node3)
        del (self.dianbiao_result_node4)
        del (self.dianbiao_result_node5)

        self.dianbiao_result_address_Entry = None

        self.dianbiao_result_tree_view = None
        self.dianbiao_result_show_tree_view = None

        self.dianbiao_result_node1 = None
        self.dianbiao_result_node2 = None
        self.dianbiao_result_node3 = None
        self.dianbiao_result_node4 = None
        self.dianbiao_result_node5 = None

        self.dianbiao_result_flag1 = 0
        self.dianbiao_result_flag2 = 0
        self.dianbiao_result_flag3 = 0

        del(self.show_result_entry_tk)
        self.show_result_entry_tk=None

        del (self.menu_mouse_show)
        self.menu_mouse_show = None
    def dianbiao_menu_new_dir_select_button(self):
        filePath = filedialog.askdirectory()
        if (filePath != ''):
            self.menu_new_dir_stringvar.set(filePath)

    def dianbiao_menu_new_save_button(self):
        pwd_str_tmp=""
        config_data={}
        if (len(self.menu_new_name_stringvar.get())):
            name_str_tmp=self.menu_new_name_stringvar.get()
            if (len(self.menu_new_dir_stringvar.get())):
                dir_str_tmp = self.menu_new_dir_stringvar.get()
                if ((platform.system()[0] == "W") or (platform.system()[0] == "w")):
                    dir_pwd_tmp =dir_str_tmp + "\\" + name_str_tmp+".json"
                else:
                    dir_pwd_tmp = dir_str_tmp + "/" + name_str_tmp+".json"

                self.dianbiao_data_config_write_save_buttun(dir_pwd_tmp)

    def dianbiao_menu_edit_save_button(self):
        if(len(self.menu_edit_dir_string)):
            self.dianbiao_data_config_write_save_buttun(self.menu_edit_dir_string)
    ###########################feilv#################################################################################
    def dianbiao_feilv_config_new_menu(self):
        self.root.withdraw()#隐藏
        self.toplevel_tmp=Toplevel()
        self.toplevel_tmp.title(u"新建费率配置")
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW",self.dianbiao_menu_delete_window)#绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.feilv_Combobox_list=[]
        self.feilv_Entry_list=[]
        self.dianbiao_feilv_config(column_tmp=0, row_tmp=0, mainframe=mainframe, feilv_Entry_list=self.feilv_Entry_list,
                                   feilv_Combobox_list=self.feilv_Combobox_list)

        ttk.Label(mainframe, text="保存名称").grid(column=0, row=16 + 0, sticky=W)
        ttk.Label(mainframe, text="保存路径").grid(column=0, row=17 + 0, sticky=W)

        self.menu_new_name_stringvar=StringVar()
        self.menu_new_dir_stringvar=StringVar()
        ttk.Entry(mainframe, width=11, textvariable=self.menu_new_name_stringvar).grid(column=1,
                                                                                                     row=16 + 0,
                                                                                                     sticky=W)
        ttk.Entry(mainframe, width=11, textvariable=self.menu_new_dir_stringvar).grid(column=1,
                                                                                                     row=17 + 0,
                                                                                                     sticky=W)
        ttk.Button(mainframe, text="选择路径", command=self.dianbiao_menu_new_dir_select_button).grid(column=2,
                                                                                                         row=17,
                                                                                                         sticky=W)
        ttk.Button(mainframe, text="保存", command=self.dianbiao_menu_new_save_button).grid(column=2,
                                                                                                         row=18,
                                                                                                         sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)

    def dianbiao_feilv_config_edit_menu(self):
        self.root.withdraw()  # 隐藏
        config_data={}
        self.menu_edit_dir_string = filedialog.askopenfilename(title=u'打开配置文件', filetypes=[('json', '*.json'), ('All Files', '*')])
        try:
            with open(self.menu_edit_dir_string, "r") as f:
                data_tmp = f.read()
                f.close()
            config_data = eval(data_tmp)
        except :
            pass
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"编辑费率配置")
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.feilv_Combobox_list = []
        self.feilv_Entry_list = []
        self.dianbiao_feilv_config(column_tmp=0, row_tmp=0, mainframe=mainframe, feilv_Entry_list=self.feilv_Entry_list,
                                   feilv_Combobox_list=self.feilv_Combobox_list)
        try:
            for i in range(14):
                self.feilv_Entry_list[i].set(config_data["feilv_time_"+str(i+1)])
                self.feilv_Combobox_list[i].set(config_data["feilv_time_" + str(i+1)+"_way"])

        except:
            pass
        ttk.Button(mainframe, text="保存", command=self.dianbiao_menu_edit_save_button).grid(column=2,
                                                                                              row=18,
                                                                                              sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)

    ##########################dianbiao object config###########################################################
    def dianbiao_object_config_new_menu(self):
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"新建电表数量和地址配置")
        self.root.withdraw()  # 隐藏
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.all_num1_stringvar = StringVar()
        self.address_start1_stringvar = StringVar()

        self.all_num2_stringvar = StringVar()
        self.address_start2_stringvar = StringVar()

        self.all_num3_stringvar = StringVar()
        self.address_start3_stringvar = StringVar()

        self.dianbiao_object_config(column_tmp=0, row_tmp=0, mainframe=mainframe, text_tmp="单电表",
                                    all_stringvar=self.all_num1_stringvar,
                                    address_stringvar=self.address_start1_stringvar)

        self.dianbiao_object_config(column_tmp=1, row_tmp=0, mainframe=mainframe, text_tmp="三相三线",
                                    all_stringvar=self.all_num2_stringvar,
                                    address_stringvar=self.address_start2_stringvar)

        self.dianbiao_object_config(column_tmp=2, row_tmp=0, mainframe=mainframe, text_tmp="三相四线",
                                    all_stringvar=self.all_num3_stringvar,
                                    address_stringvar=self.address_start3_stringvar)

        self.dianbiao_feilv_pwd_stringvar = StringVar()
        self.dianbiao_cold_pwd_stringvar = StringVar()

        Label(mainframe, text="运行费率配置文件").grid(column=0, row=7, sticky=W)
        #Label(mainframe, text="运行冻结配置文件").grid(column=0, row=8, sticky=W)

        ttk.Entry(mainframe, width=11, textvariable=self.dianbiao_feilv_pwd_stringvar).grid(column=1,
                                                                                                 row=7,
                                                                                                 sticky=W)

        #ttk.Entry(mainframe, width=11, textvariable=self.dianbiao_cold_pwd_stringvar).grid(column=1,
        #                                                                                        row=8,
        #                                                                                          sticky=W)

        ttk.Button(mainframe, text="选择文件", command=self.dianbiao_ui_feilv_select_button).grid(column=2,
                                                                                                   row=7,
                                                                                                   sticky=W)
        #ttk.Button(mainframe, text="选择文件", command=self.dianbiao_ui_cold_select_button).grid(column=2,
        #                                                                                          row=8,
        #                                                                                          sticky=W)
        ttk.Label(mainframe, text="保存名称").grid(column=0, row=9, sticky=W)
        ttk.Label(mainframe, text="保存路径").grid(column=0, row=10, sticky=W)

        self.menu_new_name_stringvar = StringVar()
        self.menu_new_dir_stringvar = StringVar()
        ttk.Entry(mainframe, width=11, textvariable=self.menu_new_name_stringvar).grid(column=1,
                                                                                       row=9,
                                                                                       sticky=W)
        ttk.Entry(mainframe, width=11, textvariable=self.menu_new_dir_stringvar).grid(column=1,
                                                                                      row=10,
                                                                                      sticky=W)

        self.all_num1_stringvar.set("0")
        self.address_start1_stringvar.set("123456789012")

        self.all_num2_stringvar.set("0")
        self.address_start2_stringvar.set("123456789012")

        self.all_num3_stringvar.set("0")
        self.address_start3_stringvar.set("123456789012")

        ttk.Button(mainframe, text="选择路径", command=self.dianbiao_menu_new_dir_select_button).grid(column=2,
                                                                                                  row=10,
                                                                                                  sticky=W)
        ttk.Button(mainframe, text="保存", command=self.dianbiao_menu_new_save_button).grid(column=2,
                                                                                          row=11,
                                                                                          sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)

    def dianbiao_object_config_edit_menu(self):
        self.root.withdraw()  # 隐藏
        config_data = {}
        self.menu_edit_dir_string = filedialog.askopenfilename(title=u'打开配置文件', filetypes=[('json', '*.json'), ('All Files', '*')])
        try:
            with open(self.menu_edit_dir_string, "r") as f:
                data_tmp = f.read()
                f.close()
            config_data = eval(data_tmp)
        except:
            pass
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"编辑电表数量和地址配置")
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.all_num1_stringvar = StringVar()
        self.address_start1_stringvar = StringVar()

        self.all_num2_stringvar = StringVar()
        self.address_start2_stringvar = StringVar()

        self.all_num3_stringvar = StringVar()
        self.address_start3_stringvar = StringVar()

        self.dianbiao_object_config(column_tmp=0, row_tmp=0, mainframe=mainframe, text_tmp="单电表",
                                    all_stringvar=self.all_num1_stringvar,
                                    address_stringvar=self.address_start1_stringvar)

        self.dianbiao_object_config(column_tmp=1, row_tmp=0, mainframe=mainframe, text_tmp="三相三线",
                                    all_stringvar=self.all_num2_stringvar,
                                    address_stringvar=self.address_start2_stringvar)

        self.dianbiao_object_config(column_tmp=2, row_tmp=0, mainframe=mainframe, text_tmp="三相四线",
                                    all_stringvar=self.all_num3_stringvar,
                                    address_stringvar=self.address_start3_stringvar)

        self.dianbiao_feilv_pwd_stringvar = StringVar()
        self.dianbiao_cold_pwd_stringvar = StringVar()

        Label(mainframe, text="运行费率配置文件").grid(column=0, row=7, sticky=W)
        #Label(mainframe, text="运行冻结配置文件").grid(column=0, row=8, sticky=W)

        ttk.Entry(mainframe, width=11, textvariable=self.dianbiao_feilv_pwd_stringvar).grid(column=1,
                                                                                            row=7,
                                                                                            sticky=W)

        #ttk.Entry(mainframe, width=11, textvariable=self.dianbiao_cold_pwd_stringvar).grid(column=1,
        #                                                                                   row=8,
        #                                                                                   sticky=W)

        ttk.Button(mainframe, text="选择文件", command=self.dianbiao_ui_feilv_select_button).grid(column=2,
                                                                                              row=7,
                                                                                              sticky=W)
        #ttk.Button(mainframe, text="选择文件", command=self.dianbiao_ui_cold_select_button).grid(column=2,
        #                                                                                     row=8,
        #                                                                                     sticky=W)
        try:
            self.all_num1_stringvar.set(config_data["one_one_num"])
            self.address_start1_stringvar.set(config_data["one_one_address"])
        except:
            self.all_num1_stringvar.set("0")
            self.address_start1_stringvar.set("123456789012")
        try:
            self.all_num2_stringvar.set(config_data["tree_tree_num"])
            self.address_start2_stringvar.set(config_data["tree_tree_address"])
        except:
            self.all_num2_stringvar.set("0")
            self.address_start2_stringvar.set("123456789012")
        try:
            self.all_num3_stringvar.set(config_data["tree_four_num"])
            self.address_start3_stringvar.set(config_data["tree_four_address"])
        except:
            self.all_num3_stringvar.set("0")
            self.address_start3_stringvar.set("123456789012")
        try:
            self.dianbiao_feilv_pwd_stringvar.set(config_data["feilv_pwd"])
            self.dianbiao_cold_pwd_stringvar.set(config_data["cold_pwd"])

        except:
            self.dianbiao_feilv_pwd_stringvar.set("")
            self.dianbiao_cold_pwd_stringvar.set("")
        ttk.Button(mainframe, text="保存", command=self.dianbiao_menu_edit_save_button).grid(column=2,
                                                                                           row=10,
                                                                                           sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)
    ##########################cold config#############################################################################
    def dianbiao_cold_data_config_new_menu(self):
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"新建冻结配置")
        self.root.withdraw()  # 隐藏
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.cold_data = StringVar()
        self.cold_data_combox = None

        self.dianbiao_cold_data_config(column_tmp=0, row_tmp=0, mainframe=mainframe)

        ttk.Label(mainframe, text="保存名称").grid(column=0, row=6 + 0, sticky=W)
        ttk.Label(mainframe, text="保存路径").grid(column=0, row=7 + 0, sticky=W)

        self.menu_new_name_stringvar = StringVar()
        self.menu_new_dir_stringvar = StringVar()
        ttk.Entry(mainframe, width=11, textvariable=self.menu_new_name_stringvar).grid(column=1,
                                                                                       row=6 + 0,
                                                                                       sticky=W)
        ttk.Entry(mainframe, width=11, textvariable=self.menu_new_dir_stringvar).grid(column=1,
                                                                                      row=7 + 0,
                                                                                      sticky=W)
        ttk.Button(mainframe, text="选择路径", command=self.dianbiao_menu_new_dir_select_button).grid(column=2,
                                                                                                  row=7,
                                                                                                  sticky=W)
        ttk.Button(mainframe, text="保存", command=self.dianbiao_menu_new_save_button).grid(column=2,
                                                                                          row=8,
                                                                                          sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)
    def dianbiao_cold_data_config_edit_menu(self):
        self.root.withdraw()  # 隐藏
        config_data = {}
        self.menu_edit_dir_string = filedialog.askopenfilename(title=u'打开配置文件', filetypes=[('json', '*.json'), ('All Files', '*')])
        try:
            with open(self.menu_edit_dir_string, "r") as f:
                data_tmp = f.read()
                f.close()
            config_data = eval(data_tmp)
        except:
            pass
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"编辑冻结配置")
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.cold_data = StringVar()
        self.cold_data_combox = None

        self.dianbiao_cold_data_config(column_tmp=0, row_tmp=0, mainframe=mainframe)
        try:
            self.cold_data_combox.set(config_data["cold_way"])
            self.cold_data.set(config_data["cold_way_data"])

        except:
            pass

        ttk.Button(mainframe, text="保存", command=self.dianbiao_menu_edit_save_button).grid(column=2,
                                                                                           row=8,
                                                                                           sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)
    ##################################串口配置######################################
    def dianbiao_serial_config_put_show(self):
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"串口配置")
        self.root.withdraw()  # 隐藏
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.dianbiao_serial_config(column_tmp=0, row_tmp=0, mainframe=mainframe,
                                    serial_Labe_list=self.serial_Labe_list,
                                    serial_Combobox_list=self.serial_Combobox_list,
                                    serial_function_list=self.serial_button_functiion_list,
                                    serial_button_list=self.serial_button_list)

        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)
    ##################################电表运行######################################
    def dianbiao_runing_put_show(self):
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"电表运行配置")
        self.root.withdraw()  # 隐藏
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能
        self.toplevel_tmp.resizable(False, False)  # 固定大小
        mainframe = ttk.Frame(self.toplevel_tmp, padding="10 10 10 10")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        #mainframe.pack(expand=1)

        self.dianbiao_object_pwd_stringvar = StringVar()
        Label(mainframe, text="运行电表配置文件").grid(column=0, row=0, sticky=W)
        ttk.Entry(mainframe, width=50, textvariable=self.dianbiao_object_pwd_stringvar).grid(column=0,
                                                                                                  row=1,
                                                                                                  sticky=W)
        ttk.Button(mainframe, text="选择文件", command=self.dianbiao_ui_object_select_button).grid(column=2,
                                                                                                    row=1,
                                                                                                    sticky=W)
        try:
            self.dianbiao_object_pwd_stringvar.set(self.config_data["object_pwd"])

        except:
            pass
        # 开始按键 停止按键
        ttk.Button(mainframe, text="开始运行", command=self.dianbiao_object_start_button_function).grid(column=1,
                                                                                                         row=5,
                                                                                                         sticky=W)
        ttk.Button(mainframe, text="停止运行", command=self.dianbiao_object_stop_button_function).grid(column=2,
                                                                                                        row=5,
                                                                                                        sticky=W)
        for child in mainframe.winfo_children():
            child.grid_configure(padx=5, pady=5)
    ##########################cput show#############################################################################
    def dianbiao_result_check_function(self):
        #清除界面内容
        tmp_tuple=self.dianbiao_result_tree_view.get_children()
        if(len(tmp_tuple)):
            for i in tmp_tuple:
                self.dianbiao_result_tree_view.delete(i)
        #更新界面内容
        self.dianbiao_result_node1 = self.dianbiao_result_tree_view.insert('', END, text='电量数据', open=False)  # True
        self.dianbiao_result_node2 = self.dianbiao_result_tree_view.insert('', END, text='需量数据', open=False)
        #self.dianbiao_result_node3 = self.dianbiao_result_tree_view.insert('', END, text='参数变量数据', open=False)
        self.dianbiao_result_node4 = self.dianbiao_result_tree_view.insert('', END, text='冻结数据', open=False)
        tmp_list=[]
        if (len(self.dianbiao_result_address_Entry.get())>0) and (len(self.dianbiao_result_address_Entry.get()) <= 12):
            address_tmp = int(self.dianbiao_result_address_Entry.get())
            try:
                one_one_num = int(self.config_data["one_one_num"])
                one_one_address = int(self.config_data["one_one_address"])
                tree_tree_num = int(self.config_data["tree_tree_num"])
                tree_tree_address = int(self.config_data["tree_tree_address"])
                tree_four_num = int(self.config_data["tree_four_num"])
                tree_four_address = int(self.config_data["tree_four_address"])
            except:
                messagebox.showinfo("提示", "输入地址有问题或没有运行起来")
                return
            if (address_tmp < one_one_address):
                messagebox.showinfo("提示", "输入地址有问题或没有运行起来")
                return
            elif (address_tmp < (one_one_num + one_one_address)):
                if (len(self.one_one_switch_object_list) < (address_tmp - one_one_address + 1)):
                    messagebox.showinfo("提示", "输入地址有问题或没有运行起来")
                    return
                else:
                    try:
                        with open("one_one_dianbiao_dianliang", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node1, END, text='',values=tmp_list[i])
                    del(tmp_list)
                    tmp_list = []
                    try:
                        with open("one_one_dianbiao_need", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node2, END, text='',values=tmp_list[i])
                    del (tmp_list)
                    tmp_list = []
                    try:
                        with open("one_one_dianbiao_cold", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node4, END, text='',values=tmp_list[i])
            elif (address_tmp < (tree_tree_num + tree_tree_address)):
                if (len(self.tree_tree_switch_object_list) < (address_tmp - tree_tree_address + 1)):
                    messagebox.showinfo("提示", "输入地址有问题或没有运行起来")
                    return
                else:
                    try:
                        with open("tree_four_dianbiao_dianliang", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if (len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node1, END, text='',values=tmp_list[i])
                    del (tmp_list)
                    tmp_list = []
                    try:
                        with open("tree_four_dianbiao_need", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node2, END, text='',values=tmp_list[i])
                    del (tmp_list)
                    tmp_list = []
                    try:
                        with open("tree_four_dianbiao_cold", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node4, END, text='',values=tmp_list[i])
            else:
                if (len(self.tree_four_switch_object_list) < (address_tmp - tree_four_address + 1)):
                    messagebox.showinfo("提示", "输入地址有问题")
                    return
                else:
                    try:
                        with open("tree_four_dianbiao_dianliang", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if (len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node1, END, text='',values=tmp_list[i])
                    del (tmp_list)
                    tmp_list = []
                    try:
                        with open("tree_four_dianbiao_need", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node2, END, text='',values=tmp_list[i])
                    del (tmp_list)
                    tmp_list = []
                    try:
                        with open("tree_four_dianbiao_cold", "r") as f:
                            while 1:
                                data_tmp = f.readline()
                                if(len(data_tmp)):
                                    tmp_list.append(data_tmp.split(","))
                                else:
                                    break
                            f.close()
                    except:
                        pass
                    for i in range(len(tmp_list)):
                        self.dianbiao_result_tree_view.insert(self.dianbiao_result_node4, END, text='',values=tmp_list[i])
    def item_selected(self,event):
        for selected_item in self.dianbiao_result_tree_view.selection():
            item = self.dianbiao_result_tree_view.item(selected_item)

            col_str = "#%d" % 1
            record = item['values']
            text_tmp = item['text']
            if(len(record)):
                if((record[0]==u'\u53e3')):
                    self.dianbiao_result_tree_view.set(selected_item, column=col_str, value='☑')  # '☑' '口'
                else:
                    self.dianbiao_result_tree_view.set(selected_item, column=col_str, value='口')  # '☑' '口'
            elif (text_tmp == u"电量数据"):
                tmp_tuple = self.dianbiao_result_tree_view.get_children(selected_item)
                for k in tmp_tuple:
                    if (self.dianbiao_result_flag1==0):
                        self.dianbiao_result_tree_view.set(k, column=col_str, value='☑')  # '☑' '口'
                    else:
                        self.dianbiao_result_tree_view.set(k, column=col_str, value='口')  # '☑' '口'
                if (self.dianbiao_result_flag1):
                    self.dianbiao_result_flag1 = 0
                else:
                    self.dianbiao_result_flag1 = 1

            elif (text_tmp == u"需量数据"):
                tmp_tuple = self.dianbiao_result_tree_view.get_children(selected_item)
                for k in tmp_tuple:
                    if (self.dianbiao_result_flag2==0):
                        self.dianbiao_result_tree_view.set(k, column=col_str, value='☑')  # '☑' '口'
                    else:
                        self.dianbiao_result_tree_view.set(k, column=col_str, value='口')  # '☑' '口'
                if (self.dianbiao_result_flag2):
                    self.dianbiao_result_flag2 = 0
                else:
                    self.dianbiao_result_flag2 = 1
            elif (text_tmp == u"冻结数据"):
                tmp_tuple = self.dianbiao_result_tree_view.get_children(selected_item)
                for k in tmp_tuple:
                    if (self.dianbiao_result_flag3 == 0):
                        self.dianbiao_result_tree_view.set(k, column=col_str, value='☑')  # '☑' '口'
                    else:
                        self.dianbiao_result_tree_view.set(k, column=col_str, value='口')  # '☑' '口'
                if (self.dianbiao_result_flag3):
                    self.dianbiao_result_flag3 = 0
                else:
                    self.dianbiao_result_flag3 = 1
    def dianbiao_result_show_function(self):
        #清除显示内容
        tmp_tuple = self.dianbiao_result_show_tree_view.get_children()
        if (len(tmp_tuple)):
            for i in tmp_tuple:
                self.dianbiao_result_show_tree_view.delete(i)
        #开始显示
        tmp_tuple = self.dianbiao_result_tree_view.get_children()
        if (len(tmp_tuple)):
            for i in tmp_tuple:
                tmp_tuple1=self.dianbiao_result_tree_view.get_children(i)
                for k in tmp_tuple1:
                    item = self.dianbiao_result_tree_view.item(k)
                    list=item['values']
                    if(list[0]!=u'\u53e3'):
                        tmp_str=self.dianbiao_result_show_function_645(list[1])
                        tmp_list=list[1:]
                        tmp_list.append(tmp_str)
                        self.dianbiao_result_show_tree_view.insert("", END,values=tmp_list)
    def dianbiao_result_show_function_645(self,code):
        if (len(self.dianbiao_result_address_Entry.get())>0) and (len(self.dianbiao_result_address_Entry.get()) <= 12):
            address_tmp = int(self.dianbiao_result_address_Entry.get())
            diabbiao_object = self.dianbiao_find_object(address_tmp)
            code_tmp=code.strip()
            ################################dianliang###################
            if(   code_tmp=="00 00 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showSTURCT(),2)
            elif (code_tmp=="00 00 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv1_showSTRUCT(),2)
            elif (code_tmp=="00 00 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv2_showSTRUCT(),2)
            elif (code_tmp=="00 00 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv3_showSTRUCT(),2)
            elif (code_tmp=="00 00 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv4_showSTRUCT(),2)
            elif (code_tmp=="00 01 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showALL(),2)
            elif (code_tmp=="00 01 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv1_showALL(),2)
            elif (code_tmp=="00 01 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv2_showALL(),2)
            elif (code_tmp=="00 01 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv3_showALL(),2)
            elif (code_tmp=="00 01 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv4_showALL(),2)
            elif (code_tmp=="00 02 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showALL1(),2)
            elif (code_tmp=="00 02 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv1_showALL1(),2)
            elif (code_tmp=="00 02 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv2_showALL1(),2)
            elif (code_tmp=="00 02 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv3_showALL1(),2)
            elif (code_tmp=="00 02 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_active_power_electricity_feilv4_showALL1(),2)
            elif (code_tmp=="00 03 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showSTRUCT1(),2)
            elif (code_tmp=="00 03 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv1_reactive_power_electricity_showSTRUCT1(),2)
            elif (code_tmp=="00 03 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv2_reactive_power_electricity_showSTRUCT1(),2)
            elif (code_tmp=="00 03 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv3_reactive_power_electricity_showSTRUCT1(),2)
            elif (code_tmp=="00 03 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv4_reactive_power_electricity_showSTRUCT1(),2)
            elif (code_tmp=="00 04 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showSTRUCT2(),2)
            elif (code_tmp=="00 04 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv1_reactive_power_electricity_showSTRUCT2(),2)
            elif (code_tmp=="00 04 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv2_reactive_power_electricity_showSTRUCT2(),2)
            elif (code_tmp=="00 04 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv3_reactive_power_electricity_showSTRUCT2(),2)
            elif (code_tmp=="00 04 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_feilv4_reactive_power_electricity_showSTRUCT2(),2)
            elif (code_tmp=="00 05 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_all_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 05 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_feilv1_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 05 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_feilv2_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 05 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_feilv3_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 05 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_feilv4_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 06 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_all_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 06 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_feilv1_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 06 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_feilv2_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 06 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_feilv3_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 06 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_feilv4_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 07 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_all_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 07 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_feilv1_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 07 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_feilv2_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 07 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_feilv3_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 07 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_feilv4_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 08 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_all_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 08 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_feilv1_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 08 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_feilv2_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 08 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_feilv3_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 08 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_feilv4_reactive_power_electricity_showALL(),2)
            elif (code_tmp=="00 09 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showALL(),2)
            elif (code_tmp=="00 09 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv1_showALL(),2)
            elif (code_tmp=="00 09 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv2_showALL(),2)
            elif (code_tmp=="00 09 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv3_showALL(),2)
            elif (code_tmp=="00 09 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv4_showALL(),2)
            elif (code_tmp=="00 0A 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showALL1(),2)
            elif (code_tmp=="00 0A 01 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv1_showALL1(),2)
            elif (code_tmp=="00 0A 02 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv2_showALL1(),2)
            elif (code_tmp=="00 0A 03 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv3_showALL1(),2)
            elif (code_tmp=="00 0A 04 00"):
                return self.num_format_str(diabbiao_object.dianbiao_watch_power_electricity_feilv4_showALL1(),2)
            elif (code_tmp=="00 15 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showA(),2)
            elif (code_tmp=="00 16 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showA1(),2)
            elif (code_tmp=="00 17 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showASTRUCT1(),2)
            elif (code_tmp=="00 18 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showASTRUCT2(),2)
            elif (code_tmp=="00 19 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_all_reactive_power_electricity_showA(),2)
            elif (code_tmp=="00 1A 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_all_reactive_power_electricity_showA(),2)
            elif (code_tmp=="00 1B 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_all_reactive_power_electricity_showA(),2)
            elif (code_tmp=="00 1C 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_all_reactive_power_electricity_showA(),2)
            elif (code_tmp=="00 1D 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showA(),2)
            elif (code_tmp=="00 1E 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showA1(),2)
            elif (code_tmp=="00 29 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showB(),2)
            elif (code_tmp=="00 2A 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showB1(),2)
            elif (code_tmp=="00 2B 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showBSTRUCT1(),2)
            elif (code_tmp=="00 2C 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showBSTRUCT2(),2)
            elif (code_tmp=="00 2D 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_all_reactive_power_electricity_showB(),2)
            elif (code_tmp=="00 2E 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_all_reactive_power_electricity_showB(),2)
            elif (code_tmp=="00 2F 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_all_reactive_power_electricity_showB(),2)
            elif (code_tmp=="00 30 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_all_reactive_power_electricity_showB(),2)
            elif (code_tmp=="00 31 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showB(),2)
            elif (code_tmp=="00 32 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showB1(),2)
            elif (code_tmp=="00 3D 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showC(),2)
            elif (code_tmp=="00 3E 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showC1(),2)
            elif (code_tmp=="00 3F 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showCSTRUCT1(),2)
            elif (code_tmp=="00 40 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showCSTRUCT2(),2)
            elif (code_tmp=="00 41 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant1_all_reactive_power_electricity_showC(),2)
            elif (code_tmp=="00 42 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant2_all_reactive_power_electricity_showC(),2)
            elif (code_tmp=="00 43 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant3_all_reactive_power_electricity_showC(),2)
            elif (code_tmp=="00 44 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_quadrant4_all_reactive_power_electricity_showC(),2)
            elif (code_tmp=="00 45 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showC(),2)
            elif (code_tmp=="00 46 00 00"):
                return self.num_format_str(diabbiao_object.dianbiao_all_watch_power_electricity_showC1(),2)

            #########################need#####################################
            elif (code_tmp=="01 01 00 00"):
                data=diabbiao_object.dianbiao_all_active_power_electricity_needALL_show() / 1000
                return self.num_format_str(data,4) +" : "+ diabbiao_object.dianbiao_all_active_power_electricity_needtimeALL_show()
            elif (code_tmp=="01 01 01 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv1_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv1_needtimeALL_show()
            elif (code_tmp=="01 01 02 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv2_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv2_needtimeALL_show()
            elif (code_tmp=="01 01 03 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv3_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv3_needtimeALL_show()
            elif (code_tmp=="01 01 04 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv4_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv4_needtimeALL_show()
            elif (code_tmp=="01 02 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeALL1_show()
            elif (code_tmp=="01 02 01 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv1_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv1_needtimeALL1_show()
            elif (code_tmp=="01 02 02 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv2_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv2_needtimeALL1_show()
            elif (code_tmp=="01 02 03 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv3_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv3_needtimeALL1_show()
            elif (code_tmp=="01 02 04 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_feilv4_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_feilv4_needtimeALL1_show()
            elif (code_tmp=="01 03 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct1ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct1ALL_show()
            elif (code_tmp=="01 03 01 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv1_needstruct1ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv1_needtimestruct1ALL_show()
            elif (code_tmp=="01 03 02 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv2_needstruct1ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv2_needtimestruct1ALL_show()
            elif (code_tmp=="01 03 03 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv3_needstruct1ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv3_needtimestruct1ALL_show()
            elif (code_tmp=="01 03 04 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv4_needstruct1ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv4_needtimestruct1ALL_show()
            elif (code_tmp=="01 04 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct2ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct2ALL_show()
            elif (code_tmp=="01 04 01 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv1_needstruct2ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv1_needtimestruct2ALL_show()
            elif (code_tmp=="01 04 02 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv2_needstruct2ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv2_needtimestruct2ALL_show()
            elif (code_tmp=="01 04 03 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv3_needstruct2ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv3_needtimestruct2ALL_show()
            elif (code_tmp=="01 04 04 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv4_needstruct2ALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_feilv4_needtimestruct2ALL_show()
            elif (code_tmp=="01 05 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needtimeALL_show()
            elif (code_tmp=="01 05 01 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv1_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv1_needtimeALL_show()
            elif (code_tmp=="01 05 02 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv2_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv2_needtimeALL_show()
            elif (code_tmp=="01 05 03 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv3_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv3_needtimeALL_show()
            elif (code_tmp=="01 05 04 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv4_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_feilv4_needtimeALL_show()
            elif (code_tmp=="01 06 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needtimeALL_show()
            elif (code_tmp=="01 06 01 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv1_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv1_needtimeALL_show()
            elif (code_tmp=="01 06 02 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv2_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv2_needtimeALL_show()
            elif (code_tmp=="01 06 03 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv3_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv3_needtimeALL_show()
            elif (code_tmp=="01 06 04 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv4_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_feilv4_needtimeALL_show()
            elif (code_tmp=="01 07 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needtimeALL_show()
            elif (code_tmp=="01 07 01 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv1_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv1_needtimeALL_show()
            elif (code_tmp=="01 07 02 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv2_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv2_needtimeALL_show()
            elif (code_tmp=="01 07 03 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv3_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv3_needtimeALL_show()
            elif (code_tmp=="01 07 04 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv4_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_feilv4_needtimeALL_show()
            elif (code_tmp=="01 08 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needtimeALL_show()
            elif (code_tmp=="01 08 01 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv1_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv1_needtimeALL_show()
            elif (code_tmp=="01 08 02 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv2_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv2_needtimeALL_show()
            elif (code_tmp=="01 08 03 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv3_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv3_needtimeALL_show()
            elif (code_tmp=="01 08 04 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv4_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_feilv4_needtimeALL_show()
            elif (code_tmp=="01 09 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeALL_show()
            elif (code_tmp=="01 09 01 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv1_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv1_needtimeALL_show()
            elif (code_tmp=="01 09 02 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv2_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv2_needtimeALL_show()
            elif (code_tmp=="01 09 03 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv3_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv3_needtimeALL_show()
            elif (code_tmp=="01 09 04 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv4_needALL_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv4_needtimeALL_show()
            elif (code_tmp=="01 0A 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeALL1_show()
            elif (code_tmp=="01 0A 01 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv1_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv1_needtimeALL1_show()
            elif (code_tmp=="01 0A 02 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv2_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv2_needtimeALL1_show()
            elif (code_tmp=="01 0A 03 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv3_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv3_needtimeALL1_show()
            elif (code_tmp=="01 0A 04 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_feilv4_needALL1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_feilv4_needtimeALL1_show()
            elif (code_tmp=="01 15 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needA_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeA_show()
            elif (code_tmp=="01 16 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needA1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeA1_show()
            elif (code_tmp=="01 17 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct1A_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct1A_show()
            elif (code_tmp=="01 18 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct2A_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct2A_show()
            elif (code_tmp=="01 19 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needA_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needtimeA_show()
            elif (code_tmp=="01 1A 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needA_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needtimeA_show()
            elif (code_tmp=="01 1B 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needA_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needtimeA_show()
            elif (code_tmp=="01 1C 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needA_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needtimeA_show()
            elif (code_tmp=="01 1D 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needA_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeA_show()
            elif (code_tmp=="01 1E 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needA1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeA1_show()
            elif (code_tmp=="01 29 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needB_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeB_show()
            elif (code_tmp=="01 2A 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needB1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeB1_show()
            elif (code_tmp=="01 2B 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct1B_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct1B_show()
            elif (code_tmp=="01 2C 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct2B_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct2B_show()
            elif (code_tmp=="01 2D 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needB_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needtimeB_show()
            elif (code_tmp=="01 2E 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needB_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needtimeB_show()
            elif (code_tmp=="01 2F 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needB_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needtimeB_show()
            elif (code_tmp=="01 30 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needB_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needtimeB_show()
            elif (code_tmp=="01 31 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needB_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeB_show()
            elif (code_tmp=="01 32 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needB1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeB1_show()
            elif (code_tmp=="01 3D 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needC_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeC_show()
            elif (code_tmp=="01 3E 00 00"):
                data = diabbiao_object.dianbiao_all_active_power_electricity_needC1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_active_power_electricity_needtimeC1_show()
            elif (code_tmp=="01 3F 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct1C_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct1C_show()
            elif (code_tmp=="01 40 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needstruct2C_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant_reactive_power_electricity_needtimestruct2C_show()
            elif (code_tmp=="01 41 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needC_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant1_reactive_power_electricity_needtimeC_show()
            elif (code_tmp=="01 42 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needC_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant2_reactive_power_electricity_needtimeC_show()
            elif (code_tmp=="01 43 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needC_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant3_reactive_power_electricity_needtimeC_show()
            elif (code_tmp=="01 44 00 00"):
                data = diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needC_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_quadrant4_reactive_power_electricity_needtimeC_show()
            elif (code_tmp=="01 45 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needC_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeC_show()
            elif (code_tmp=="01 46 00 00"):
                data = diabbiao_object.dianbiao_all_watch_power_electricity_needC1_show() / 1000
                return self.num_format_str(data,4) + " : " + diabbiao_object.dianbiao_all_watch_power_electricity_needtimeC1_show()

            ##########################################COLD#########################################################
            elif (code_tmp=="05 00 00 01"):
                return diabbiao_object.dianbiao_cold_data_set_time_time(1)
            elif (code_tmp=="05 00 01 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv1ALL(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv2ALL(1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv3ALL(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv4ALL(1)
                return self.num_format_str(data1,2)+" : "+self.num_format_str(data2,2)+" : "+self.num_format_str(data3,2)+" : "+self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 02 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricityALL1(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv1ALL1(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv2ALL1(1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv3ALL1(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv4ALL1(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 03 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricitySTRUCT1(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv1STRUCT1(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv2STRUCT1(1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv3STRUCT1(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv4STRUCT1(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 04 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricitySTRUCT2(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv1STRUCT2(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv2STRUCT2(1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv3STRUCT2(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power_electricity_feilv4STRUCT2(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 05 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant1_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant1_reactive_power_electricity_feilv1ALL(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant1_reactive_power_electricity_feilv2ALL(1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant1_reactive_power_electricity_feilv3ALL(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant1_reactive_power_electricity_feilv4ALL(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 06 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant2_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant2_reactive_power_electricity_feilv1ALL(
                    1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant2_reactive_power_electricity_feilv2ALL(
                    1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant2_reactive_power_electricity_feilv3ALL(
                    1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant2_reactive_power_electricity_feilv4ALL(
                    1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 07 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant3_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant3_reactive_power_electricity_feilv1ALL(
                    1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant3_reactive_power_electricity_feilv2ALL(
                    1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant3_reactive_power_electricity_feilv3ALL(
                    1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant3_reactive_power_electricity_feilv4ALL(
                    1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 00 08 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant4_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant4_reactive_power_electricity_feilv1ALL(
                    1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant4_reactive_power_electricity_feilv2ALL(
                    1)
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant4_reactive_power_electricity_feilv3ALL(
                    1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_quadrant4_reactive_power_electricity_feilv4ALL(
                    1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2) +" : " + self.num_format_str(data5,2)
            elif (code_tmp=="05 00 09 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_needALL(1) / 1000
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_needtimeALL(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv1_needALL(1) / 1000
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv1_needtimeALL(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv2_needALL(1) / 1000
                data6 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv2_needtimeALL(1)
                data7 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv3_needALL(1) / 1000
                data8 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv3_needtimeALL(1)
                data9 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv4_needALL(1) / 1000
                data10 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv4_needtimeALL(1)
                return self.num_format_str(data1,4)+" : "+data2+" : "+self.num_format_str(data3,4)+" : "+data4+" : "+self.num_format_str(data5,4)+" : "+data6+" : "+self.num_format_str(data7,4)+" : "+data8+" : "+self.num_format_str(data9,4)+" : "+data10
            elif (code_tmp=="05 00 0A 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_needALL1(1) / 1000
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_needtimeALL1(1)
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv1_needALL1(
                    1) / 1000
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv1_needtimeALL1(1)
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv2_needALL1(
                    1) / 1000
                data6 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv2_needtimeALL1(1)
                data7 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv3_needALL1(
                    1) / 1000
                data8 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv3_needtimeALL1(1)
                data9 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv4_needALL1(
                    1) / 1000
                data10 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power_electricity_feilv4_needtimeALL1(1)
                return self.num_format_str(data1,4) +" : "+ data2 +" : "+ self.num_format_str(data3,4) +" : "+ data4 +" : "+ self.num_format_str(data5,4) +" : "+ data6 +" : "+ self.num_format_str(data7,4) +" : "+ data8 +" : "+ self.num_format_str(data9,4) +" : "+ data10
            elif (code_tmp=="05 00 10 01"):
                data1 = diabbiao_object.dianbiao_cold_data_set_time_all_active_power(1)    / 1000
                data2 = diabbiao_object.dianbiao_cold_data_set_time_all_active_powerA(1)   / 1000
                data3 = diabbiao_object.dianbiao_cold_data_set_time_all_active_powerB(1)   / 1000
                data4 = diabbiao_object.dianbiao_cold_data_set_time_all_active_powerC(1)   / 1000
                data5 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_power(1)  / 1000
                data6 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_powerA(1) / 1000
                data7 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_powerB(1) / 1000
                data8 = diabbiao_object.dianbiao_cold_data_set_time_all_reactive_powerC(1) / 1000
                return self.num_format_str(data1,4) +" : "+ self.num_format_str(data2,4) +" : "+ self.num_format_str(data3,4) +" : "+ self.num_format_str(data4,4) +" : "+ self.num_format_str(data5,4) +" : "+ self.num_format_str(data6,4) +" : "+ self.num_format_str(data7,4) +" : "+ self.num_format_str(data8,4)
##################################################
            elif (code_tmp=="05 06 00 01"):
                return diabbiao_object.dianbiao_cold_data_day_time(1)
            elif (code_tmp=="05 06 01 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv1ALL(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv2ALL(1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv3ALL(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv4ALL(1)
                return self.num_format_str(data1,2)+" : "+self.num_format_str(data2,2)+" : "+self.num_format_str(data3,2)+" : "+self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 06 02 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricityALL1(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv1ALL1(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv2ALL1(1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv3ALL1(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv4ALL1(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 06 03 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricitySTRUCT1(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv1STRUCT1(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv2STRUCT1(1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv3STRUCT1(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv4STRUCT1(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 06 04 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricitySTRUCT2(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv1STRUCT2(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv2STRUCT2(1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv3STRUCT2(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power_electricity_feilv4STRUCT2(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : " +self.num_format_str(data5,2)
            elif (code_tmp=="05 06 05 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_quadrant1_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_quadrant1_reactive_power_electricity_feilv1ALL(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_quadrant1_reactive_power_electricity_feilv2ALL(1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_quadrant1_reactive_power_electricity_feilv3ALL(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_quadrant1_reactive_power_electricity_feilv4ALL(1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 06 06 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_quadrant2_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_quadrant2_reactive_power_electricity_feilv1ALL(
                    1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_quadrant2_reactive_power_electricity_feilv2ALL(
                    1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_quadrant2_reactive_power_electricity_feilv3ALL(
                    1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_quadrant2_reactive_power_electricity_feilv4ALL(
                    1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 06 07 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_quadrant3_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_quadrant3_reactive_power_electricity_feilv1ALL(
                    1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_quadrant3_reactive_power_electricity_feilv2ALL(
                    1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_quadrant3_reactive_power_electricity_feilv3ALL(
                    1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_quadrant3_reactive_power_electricity_feilv4ALL(
                    1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2)+" : "+self.num_format_str(data5,2)
            elif (code_tmp=="05 06 08 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_quadrant4_reactive_power_electricityALL(1)
                data2 = diabbiao_object.dianbiao_cold_data_day_all_quadrant4_reactive_power_electricity_feilv1ALL(
                    1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_quadrant4_reactive_power_electricity_feilv2ALL(
                    1)
                data4 = diabbiao_object.dianbiao_cold_data_day_all_quadrant4_reactive_power_electricity_feilv3ALL(
                    1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_quadrant4_reactive_power_electricity_feilv4ALL(
                    1)
                return self.num_format_str(data1,2) +" : " + self.num_format_str(data2,2) +" : " + self.num_format_str(data3,2) +" : " + self.num_format_str(data4,2) +" : "+ self.num_format_str(data5,2)
            elif (code_tmp=="05 06 09 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_needALL(1) / 1000
                data2 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_needtimeALL(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv1_needALL(1) / 1000
                data4 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv1_needtimeALL(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv2_needALL(1) / 1000
                data6 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv2_needtimeALL(1)
                data7 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv3_needALL(1) / 1000
                data8 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv3_needtimeALL(1)
                data9 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv4_needALL(1) / 1000
                data10 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv4_needtimeALL(1)
                return self.num_format_str(data1,4)+" : "+data2+" : "+self.num_format_str(data3,4)+" : "+data4+" : "+self.num_format_str(data5,4)+" : "+data6+" : "+self.num_format_str(data7,4)+" : "+data8+" : "+self.num_format_str(data9,4)+" : "+data10
            elif (code_tmp=="05 06 0A 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_needALL1(1) / 1000
                data2 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_needtimeALL1(1)
                data3 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv1_needALL1(
                    1) / 1000
                data4 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv1_needtimeALL1(1)
                data5 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv2_needALL1(
                    1) / 1000
                data6 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv2_needtimeALL1(1)
                data7 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv3_needALL1(
                    1) / 1000
                data8 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv3_needtimeALL1(1)
                data9 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv4_needALL1(
                    1) / 1000
                data10 = diabbiao_object.dianbiao_cold_data_day_all_active_power_electricity_feilv4_needtimeALL1(1)
                return self.num_format_str(data1,4) +" : "+ data2 +" : "+ self.num_format_str(data3,4) +" : "+ data4 +" : "+ self.num_format_str(data5,4) +" : "+ data6 +" : "+ self.num_format_str(data7,4) +" : "+ data8 +" : "+ self.num_format_str(data9,4) +" : "+ data10
            elif (code_tmp=="05 06 10 01"):
                data1 = diabbiao_object.dianbiao_cold_data_day_all_active_power(1)    / 1000
                data2 = diabbiao_object.dianbiao_cold_data_day_all_active_powerA(1)   / 1000
                data3 = diabbiao_object.dianbiao_cold_data_day_all_active_powerB(1)   / 1000
                data4 = diabbiao_object.dianbiao_cold_data_day_all_active_powerC(1)   / 1000
                data5 = diabbiao_object.dianbiao_cold_data_day_all_reactive_power(1)  / 1000
                data6 = diabbiao_object.dianbiao_cold_data_day_all_reactive_powerA(1) / 1000
                data7 = diabbiao_object.dianbiao_cold_data_day_all_reactive_powerB(1) / 1000
                data8 = diabbiao_object.dianbiao_cold_data_day_all_reactive_powerC(1) / 1000
                return self.num_format_str(data1,4) +" : "+ self.num_format_str(data2,4) +" : "+ self.num_format_str(data3,4) +" : "+ self.num_format_str(data4,4) +" : "+ self.num_format_str(data5,4) +" : "+ self.num_format_str(data6,4) +" : "+ self.num_format_str(data7,4) +" : "+ self.num_format_str(data8,4)
            else:
                return 0




        else:
            return 0
    def dianbiao_result_put_show(self):
        self.toplevel_tmp = Toplevel()
        self.toplevel_tmp.title(u"电表查询和显示")
        self.root.withdraw()  # 隐藏
        self.toplevel_tmp.protocol("WM_DELETE_WINDOW", self.dianbiao_menu_delete_window)  # 绑定返回功能


        self.dianbiao_result_address_Entry = StringVar()
        width_tmp=18
        ################################################################################
        self.menu_mouse_show = Menu(self.toplevel_tmp,
                                    tearoff=False,
                                    # bg="black",
                                    )
        self.menu_mouse_show.add_command(label="剪切", command=self.mouse_cut_show)
        self.menu_mouse_show.add_command(label="复制", command=self.mouse_copy_show)
        self.menu_mouse_show.add_command(label="粘贴", command=self.mouse_paste_show)
        #################################################################################
        tmp1=ttk.Label(self.toplevel_tmp, text="电表地址", width=width_tmp)
        tmp1.pack(side=TOP,fill=BOTH,expand=1)

        self.show_result_entry_tk = ttk.Entry(self.toplevel_tmp, width=width_tmp, textvariable=self.dianbiao_result_address_Entry)
        self.show_result_entry_tk.pack(side=TOP,fill=BOTH,expand=1 )
        self.show_result_entry_tk.bind('<FocusOut>', self.dianbiao_object_config_address_check)
        self.show_result_entry_tk.bind("<Button-3>", self.mouse_popup_show)

        tmp2=ttk.Button(self.toplevel_tmp, text="选择项更新", width=width_tmp,command=self.dianbiao_result_check_function)#
        tmp2.pack(side=TOP,fill=BOTH,expand=1)
        #################################
        # 配置树
        tmp3=ttk.Label(self.toplevel_tmp, text="配置图表", width=width_tmp)
        tmp3.pack(side=TOP,fill=BOTH,expand=1)

        mainframe = ttk.Frame(self.toplevel_tmp)
        mainframe.pack(side=TOP, fill=BOTH, expand=1)

        self.dianbiao_result_tree_view = ttk.Treeview(mainframe, columns=('11', '12', '13'),selectmode="browse")

        # define headings
        self.dianbiao_result_tree_view.column('#0', width=90, anchor=CENTER)  # , stretch=False
        self.dianbiao_result_tree_view.column('11', width=160, anchor=CENTER)
        self.dianbiao_result_tree_view.column('12', width=160, anchor=CENTER)
        self.dianbiao_result_tree_view.column('13', width=160, anchor=CENTER)

        self.dianbiao_result_tree_view.heading('#0', text='分类')
        self.dianbiao_result_tree_view.heading('11', text='选择')
        self.dianbiao_result_tree_view.heading('12', text='标识码')
        self.dianbiao_result_tree_view.heading('13', text='名称')

        self.dianbiao_result_tree_view.bind('<<TreeviewSelect>>', self.item_selected)
        self.dianbiao_result_tree_view.pack(side=LEFT,fill=BOTH,expand=1)

        # add a scrollbar
        scrollbary = ttk.Scrollbar(mainframe, orient=VERTICAL, command=self.dianbiao_result_tree_view.yview)
        self.dianbiao_result_tree_view.configure(yscrollcommand=scrollbary.set)
        scrollbary.pack(side=RIGHT,fill=Y)

        scrollbarx = ttk.Scrollbar(self.toplevel_tmp, orient=HORIZONTAL, command=self.dianbiao_result_tree_view.xview)
        self.dianbiao_result_tree_view.configure(xscrollcommand=scrollbarx.set)
        scrollbarx.pack(side=TOP,fill=BOTH,expand=1)


        ##### 显示树

        tmp4=ttk.Button(self.toplevel_tmp, text="显示", width=width_tmp,command=self.dianbiao_result_show_function)
        tmp4.pack(side=TOP,fill=BOTH,expand=1)

        tmp5=ttk.Label(self.toplevel_tmp, text="显示图表", width=width_tmp)
        tmp5.pack(side=TOP,fill=BOTH,expand=1)

        mainframe2 = ttk.Frame(self.toplevel_tmp)
        mainframe2.pack(side=TOP, fill=BOTH, expand=1)

        self.dianbiao_result_show_tree_view  = ttk.Treeview(mainframe2, columns=('11', '12','13'),selectmode="browse",show="headings")
        self.dianbiao_result_show_tree_view.column('#0', width=90, anchor=CENTER)  # , stretch=False
        self.dianbiao_result_show_tree_view.column('11', width=160, anchor=CENTER)
        self.dianbiao_result_show_tree_view.column('12', width=160, anchor=CENTER)
        self.dianbiao_result_show_tree_view.column('13', width=260, anchor=CENTER)

        ##self.dianbiao_result_show_tree_view.heading('#0', text='标识码')
        self.dianbiao_result_show_tree_view.heading('11', text='标识码')
        self.dianbiao_result_show_tree_view.heading('12', text='名称')
        self.dianbiao_result_show_tree_view.heading('13', text='值')

        self.dianbiao_result_show_tree_view.pack(side=LEFT,fill=BOTH,expand=1)

        show_tree_scrollbary = ttk.Scrollbar(mainframe2, orient=VERTICAL, command=self.dianbiao_result_show_tree_view.yview)
        self.dianbiao_result_show_tree_view.configure(yscrollcommand=show_tree_scrollbary.set)
        show_tree_scrollbary.pack(side=RIGHT,fill=Y)

        show_tree_scrollbarx = ttk.Scrollbar(self.toplevel_tmp, orient=HORIZONTAL, command=self.dianbiao_result_show_tree_view.xview)
        self.dianbiao_result_show_tree_view.configure(xscrollcommand=show_tree_scrollbarx.set)
        show_tree_scrollbarx.pack(side=TOP,fill=BOTH,expand=1)
    ##############################冻结数据的config########################
    def dianbiao_cool_config_time_check(self,event):
        tuple_tmp=self.cold_data_way_tuple
        if(self.cold_data_combox.get()==tuple_tmp[0]):
            self.cold_data.set("")
        elif (self.cold_data_combox.get()==tuple_tmp[1]):
            if(len(self.cold_data.get())==5):
                if(":" in self.cold_data.get()):
                    tmp_list=self.cold_data.get().split(":")
                    if (int(tmp_list[1]) >= 0 and int(tmp_list[1]) <= 60):
                        pass
                    else:
                        self.cold_data.set("")

                    if (int(tmp_list[0]) >= 0 and int(tmp_list[0]) <= 24):
                        pass
                    else:
                        self.cold_data.set("")
                else:
                    self.cold_data.set("")
            else:
                self.cold_data.set("")

        elif (self.cold_data_combox.get() == tuple_tmp[2]):
            self.cold_data.set("")

        elif (self.cold_data_combox.get() == tuple_tmp[3]):
            if (len(self.cold_data.get()) == 2):
                tmp_int=int(self.cold_data.get())
                if(tmp_int>=0 and tmp_int<=60):
                    pass
                else:
                    self.cold_data.set("")
            else:
                self.cold_data.set("")

    def dianbiao_cold_data_config(self,column_tmp,row_tmp, mainframe):
        Label(mainframe, text="冻结设置").grid(column=column_tmp, row=row_tmp, sticky=W)
        self.cold_data_combox = ttk.Combobox(mainframe, width=10)
        self.cold_data_combox['value'] = self.cold_data_way_tuple
        self.cold_data_combox.current(0)
        self.cold_data_combox.state(["readonly"])
        self.cold_data_combox.grid(column=column_tmp, row=row_tmp + 1, sticky=W)

        cold_data_tmp = ttk.Entry(mainframe, width=5, textvariable=self.cold_data)
        cold_data_tmp.grid(column=column_tmp+1, row=row_tmp+1, sticky=W)
        cold_data_tmp.bind('<FocusOut>', self.dianbiao_cool_config_time_check)
    ################################dianbiao 具体数据处理###################################################
    def dianbiao_object_config_all_num_check(self,event):
        try:
            num_tmp = event.widget.get()
            int_tmp=int(num_tmp)
        except:
            event.widget.delete(0, END)  # 清空内容
            return
        if(int_tmp>2000):
            event.widget.delete(0, END)  # 清空内容
            return

        if (self.address_start1_stringvar):
            if (len(self.address_start1_stringvar.get())):
                address_tmp = int(self.address_start1_stringvar.get())
                self.address_start1_stringvar.set(format(int(address_tmp), "0" + str(12) + "d"))
                if (self.all_num1_stringvar):
                    if (len(self.all_num1_stringvar.get())):
                        address_tmp += int(self.all_num1_stringvar.get())
                        if (self.address_start2_stringvar):
                            self.address_start2_stringvar.set(format(int(address_tmp), "0" + str(12) + "d"))
                            if (self.all_num2_stringvar):
                                if (len(self.all_num2_stringvar.get())):
                                    address_tmp += int(self.all_num2_stringvar.get())
                                    if (self.address_start3_stringvar):
                                        self.address_start3_stringvar.set(format(int(address_tmp), "0" + str(12) + "d"))

    def dianbiao_object_config_address_check(self,event):
        address_tmp=event.widget.get()#.strip()

        if (len(address_tmp)>12):
            event.widget.delete(0, END)  # 清空内容
            return
        if (self.address_start1_stringvar):
            if (len(self.address_start1_stringvar.get())):
                address_tmp = int(self.address_start1_stringvar.get())
                self.address_start1_stringvar.set(format(int(address_tmp), "0" + str(12) + "d"))
                if (self.all_num1_stringvar):
                    if (len(self.all_num1_stringvar.get())):
                        address_tmp += int(self.all_num1_stringvar.get())
                        if (self.address_start2_stringvar):
                            self.address_start2_stringvar.set(format(int(address_tmp),  "0"+str(12) + "d"))
                            if (self.all_num2_stringvar):
                                if (len(self.all_num2_stringvar.get())):
                                    address_tmp += int(self.all_num2_stringvar.get())
                                    if (self.address_start3_stringvar):
                                        self.address_start3_stringvar.set(format(int(address_tmp), "0" + str(12) + "d"))

    def dianbiao_object_config(self, column_tmp,row_tmp, mainframe, text_tmp,all_stringvar,address_stringvar):
        Label_tmp=Label(mainframe, text=text_tmp)
        Label_tmp.grid(column=column_tmp, row=row_tmp, sticky=W)
        #Label_tmp.configure(bg="white")#red green white

        # 总数 label
        ttk.Label(mainframe, text="模拟数量").grid(column=column_tmp, row=row_tmp+1, sticky=W)
        # 总数 输入框
        num = ttk.Entry(mainframe, width=5, textvariable=all_stringvar)
        num.grid(column=column_tmp, row=row_tmp+2, sticky=W)
        num.bind('<FocusOut>', self.dianbiao_object_config_all_num_check)
        # 地址 label
        ttk.Label(mainframe, text="开始地址").grid(column=column_tmp, row=row_tmp+3, sticky=W)
        # 12位地址 输入框
        address = ttk.Entry(mainframe, width=12, textvariable=address_stringvar)
        address.grid(column=column_tmp, row=row_tmp+4, sticky=W)
        address.bind('<FocusOut>', self.dianbiao_object_config_address_check)

    ##################################dianbiao_feilv##################################################################
    def dianbiao_feilv_config_time_updata(self,index):
        tmp_list=[]
        tmp_list.append(0)
        tmp_list.append(24*60)
        for i in range(13):
            time_tmp = self.feilv_Entry_list[i].get().strip()
            if(len(time_tmp)):
                time_tmp_list = time_tmp.split("-")
                time_tmp_start_list = time_tmp_list[0].split(":")
                time_tmp_start_hour = int(time_tmp_start_list[0])
                time_tmp_start_min = int(time_tmp_start_list[1])
                time_tmp_end_list = time_tmp_list[1].split(":")
                time_tmp_end_hour = int(time_tmp_end_list[0])
                time_tmp_end_min = int(time_tmp_end_list[1])
                start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
                end_min_tmp = (time_tmp_end_hour * 60 + time_tmp_end_min)
                tmp_list.append(start_min_tmp)
                tmp_list.append(end_min_tmp)
            else:
                tmp_list_tmp=[]
                tmp_list=sorted(tmp_list)
                k=0
                while (k<len(tmp_list)):
                    if(k==len(tmp_list)-1):
                        tmp_list_tmp.append(tmp_list[k])
                        k += 1
                        continue
                    if(tmp_list[k]!=tmp_list[k+1]):
                        tmp_list_tmp.append(tmp_list[k])
                        k+=1
                    else:
                        k+=2
                if((len(tmp_list_tmp)/2)>(14-i)):
                    self.feilv_Entry_list[index].set("")
                else:
                    for k in range((len(tmp_list_tmp)/2)):
                        start_hour=str((tmp_list_tmp[k*2]-tmp_list_tmp[k*2]%60)/60)
                        start_min=str(tmp_list_tmp[k*2]%60)
                        end_hour = str((tmp_list_tmp[k * 2+1] - tmp_list_tmp[k * 2+1] % 60) / 60)
                        end_min = str(tmp_list_tmp[k * 2+1] % 60)
                        if(len(start_hour)==1):
                            time_str="0"+start_hour+":"
                        else:
                            time_str=start_hour+":"
                        if (len(start_min) == 1):
                            time_str = time_str+"0" + start_min+"-"
                        else:
                            time_str = time_str + start_min+"-"
                        if (len(end_hour) == 1):
                            time_str = time_str+"0" + end_hour+":"
                        else:
                            time_str = time_str +  end_hour+":"
                        if (len(end_min) == 1):
                            time_str = time_str+"0" + end_min
                        else:
                            time_str = time_str + end_min
                        self.feilv_Entry_list[i].set(time_str)
                        i+=1
                    return
    def dianbiao_feilv_config_time_check1(self, event):
        index = 0
        time_tmp = event.widget.get().strip()
        if(":"in time_tmp):
            if("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (time_tmp_start_hour * 60 + time_tmp_start_min)+15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return

        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)



    def dianbiao_feilv_config_time_check2(self, event):
        index = 1
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)

    def dianbiao_feilv_config_time_check3(self, event):
        index = 2
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check4(self, event):
        index = 3
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check5(self, event):
        index = 4
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check6(self, event):
        index = 5
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check7(self, event):
        index = 6
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check8(self, event):
        index = 7
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check9(self, event):
        index = 8
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check10(self, event):
        index = 9
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check11(self, event):
        index = 10
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check12(self, event):
        index = 11
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check13(self, event):
        index = 12
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
    def dianbiao_feilv_config_time_check14(self, event):
        index=13
        time_tmp = event.widget.get().strip()
        if (":" in time_tmp):
            if ("-" in time_tmp):
                if (len(time_tmp) == 11):
                    time_tmp_list = time_tmp.split("-")
                    time_tmp_start_list = time_tmp_list[0].split(":")
                    time_tmp_start_hour = int(time_tmp_start_list[0])
                    time_tmp_start_min = int(time_tmp_start_list[1])
                    time_tmp_end_list = time_tmp_list[1].split(":")
                    time_tmp_end_hour = int(time_tmp_end_list[0])
                    time_tmp_end_min = int(time_tmp_end_list[1])
                    if ((time_tmp_end_hour * 60 + time_tmp_end_min) >= (
                            time_tmp_start_hour * 60 + time_tmp_start_min) + 15):
                        pass
                    else:
                        event.widget.delete(0, END)  # 清空内容
                        return
                else:
                    event.widget.delete(0, END)  # 清空内容
                    return
            else:
                event.widget.delete(0, END)  # 清空内容
                return
        else:
            event.widget.delete(0, END)  # 清空内容
            return
        time_tmp = self.feilv_Entry_list[index].get().strip()
        time_tmp_list = time_tmp.split("-")
        time_tmp_start_list = time_tmp_list[0].split(":")
        time_tmp_start_hour = int(time_tmp_start_list[0])
        time_tmp_start_min = int(time_tmp_start_list[1])
        time_tmp_end_list = time_tmp_list[1].split(":")
        time_tmp_end_hour = int(time_tmp_end_list[0])
        time_tmp_end_min = int(time_tmp_end_list[1])
        start_min_tmp = (time_tmp_start_hour * 60 + time_tmp_start_min)
        end_min_tmp=(time_tmp_end_hour * 60 + time_tmp_end_min)
        for i in range(14):
            if(i!=index):
                if(len(self.feilv_Entry_list[i].get().strip())):
                    time_tmp_tmp = self.feilv_Entry_list[i].get().strip()
                    time_tmp_list_tmp = time_tmp_tmp.split("-")
                    time_tmp_start_list_tmp = time_tmp_list_tmp[0].split(":")
                    time_tmp_start_hour_tmp = int(time_tmp_start_list_tmp[0])
                    time_tmp_start_min_tmp = int(time_tmp_start_list_tmp[1])
                    time_tmp_end_list_tmp = time_tmp_list_tmp[1].split(":")
                    time_tmp_end_hour_tmp = int(time_tmp_end_list_tmp[0])
                    time_tmp_end_min_tmp = int(time_tmp_end_list_tmp[1])

                    start_min_tmp_tmp = (time_tmp_start_hour_tmp * 60 + time_tmp_start_min_tmp)
                    end_min_tmp_tmp = (time_tmp_end_hour_tmp * 60 + time_tmp_end_min_tmp)
                    if(start_min_tmp<start_min_tmp_tmp):
                        if(end_min_tmp>start_min_tmp_tmp):
                            self.feilv_Entry_list[index].set("")
                            return
                    if ((start_min_tmp >= start_min_tmp_tmp)and(start_min_tmp<end_min_tmp_tmp)):
                        self.feilv_Entry_list[index].set("")
                        return
        self.dianbiao_feilv_config_time_updata(index)
#################################################################################################################################
    def dianbiao_feilv_config(self, column_tmp, row_tmp, mainframe,feilv_Entry_list,feilv_Combobox_list):
        ttk.Label(mainframe, text="22:00~07:00").grid(column=column_tmp, row=row_tmp + 0, sticky=W)
        ttk.Label(mainframe, text="需要00~24:00").grid(column=column_tmp+1, row=row_tmp + 0,
                                                                               sticky=W)
        ttk.Label(mainframe, text="00:00~07:00").grid(column=column_tmp + 2, row=row_tmp + 0,
                                                                 sticky=W)
        ttk.Label(mainframe, text="费表设置").grid(column=column_tmp, row=row_tmp + 1, sticky=W)
        for i in range(14):
            ttk.Label(mainframe, text="时段"+str(i+1)).grid(column=column_tmp, row=row_tmp +i+ 2, sticky=W)

        ttk.Label(mainframe, text="00:00-01:00 英文").grid(column=column_tmp+1, row=row_tmp+1, sticky=W)
        check_func=[]
        check_func.append(self.dianbiao_feilv_config_time_check1)
        check_func.append(self.dianbiao_feilv_config_time_check2)
        check_func.append(self.dianbiao_feilv_config_time_check3)
        check_func.append(self.dianbiao_feilv_config_time_check4)
        check_func.append(self.dianbiao_feilv_config_time_check5)
        check_func.append(self.dianbiao_feilv_config_time_check6)
        check_func.append(self.dianbiao_feilv_config_time_check7)
        check_func.append(self.dianbiao_feilv_config_time_check8)
        check_func.append(self.dianbiao_feilv_config_time_check9)
        check_func.append(self.dianbiao_feilv_config_time_check10)
        check_func.append(self.dianbiao_feilv_config_time_check11)
        check_func.append(self.dianbiao_feilv_config_time_check12)
        check_func.append(self.dianbiao_feilv_config_time_check13)
        check_func.append(self.dianbiao_feilv_config_time_check14)
        for i in range(14):
            feilv_Entry_list.append(StringVar())
            time_tmp=ttk.Entry(mainframe, width=11, textvariable=feilv_Entry_list[i])

            time_tmp.grid(column=column_tmp+1, row=row_tmp+2+i, sticky=W)

            time_tmp.bind('<FocusOut>', check_func[i])
            
        self.feilv_Entry_list[0].set("00:00-24:00")
        ttk.Label(mainframe, text="费率").grid(column=column_tmp+2, row=row_tmp+1, sticky=W)
        for  i in range(14):
            feilv_Combobox_list.append(ttk.Combobox(mainframe,  width=6))
            feilv_Combobox_list[i]['value']=('1','2','3','4')
            feilv_Combobox_list[i].current(0)
            #feilv_Combobox_list[i].state(["readonly"])
            feilv_Combobox_list[i].grid(column=column_tmp + 2, row=row_tmp + 2+i, sticky=W)

    #########################################################################################################
    def dianbiao_find_object(self,address_int):
        try:
            one_one_num=int(self.config_data["one_one_num"])
            one_one_address=int(self.config_data["one_one_address"])
            tree_tree_num = int(self.config_data["tree_tree_num"])
            tree_tree_address = int(self.config_data["tree_tree_address"])
            tree_four_num = int(self.config_data["tree_four_num"])
            tree_four_address = int(self.config_data["tree_four_address"])
        except:
            return None
        if(address_int<one_one_address):
            return None
        elif (address_int < (one_one_num + one_one_address)):
            if (len(self.one_one_switch_object_list) < (address_int - one_one_address + 1)):
                return None
            else:
                return self.one_one_switch_object_list[address_int - one_one_address]

        elif (address_int < (tree_tree_num + tree_tree_address)):
            if (len(self.tree_tree_switch_object_list) < (address_int - tree_tree_address + 1)):
                return None
            else:
                return self.tree_tree_switch_object_list[address_int - tree_tree_address]
        else:
            if (len(self.tree_four_switch_object_list) < (address_int - tree_four_address + 1)):
                return None
            else:
                return self.tree_four_switch_object_list[address_int - tree_four_address]
    #############################################显示窗口具体数据的函数####################################################

    def dianbiao_data_show_func(self):
        self.show_time_Label.set(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
        if self.show_thread_flag:
            if len(self.show_Entry.get())==0:
                self.show_thread_flag = 0
            if (len(self.show_Entry.get()))and(len(self.show_Entry.get())<=12):
                address_tmp=int(self.show_Entry.get())
                diabbiao_object=self.dianbiao_find_object(address_tmp)
                if(diabbiao_object==None):
                    self.show_thread_flag=0

                if self.show_thread_flag:
                    if(self.show_biao_Label_flag):
                        self.show_biao_Label_flag=0
                        #self.show_biao_Label.configure(bg="red")
                        self.show_biao_Label.itemconfigure('green', fill='gray')
                    else:
                        self.show_biao_Label_flag = 1
                        self.show_biao_Label.itemconfigure('green', fill='green')
                    #self.show_data11_Label.set(self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_db_showALL(1),4) )# 正向有功
                    #self.show_data12_Label.set(self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_db_showALL1(1),4) )#反向有功
                    #self.show_data13_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq1_showALL(1),4) )# 第一象限无功
                    #self.show_data14_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq2_showALL(1),4) )# 第二象限无功
                    #self.show_data15_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq3_showALL(1),4) )# 第三象限无功
                    #self.show_data16_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq4_showALL(1),4) )# 第四象限无功#

                    #self.show_data21_Label.set(self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_db_showALL(2),4) )
                    #self.show_data22_Label.set(self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_db_showALL1(2),4) )
                    #self.show_data23_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq1_showALL(2),4) )
                    #self.show_data24_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq2_showALL(2),4) )
                    #self.show_data25_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq3_showALL(2),4) )
                    #self.show_data26_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_all_reactive_power_electricity_dbq4_showALL(2),4) )

                    self.show_feilv_Label.set(diabbiao_object.dianbiao_feilv_show())

                    self.show_data31_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_voltage_showA(), 1))
                    self.show_data32_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_current_showA(), 3))
                    self.show_data33_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_voltage_showB(), 1))
                    self.show_data34_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_current_showB(), 3))
                    self.show_data35_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_voltage_showC(), 1))
                    self.show_data36_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_current_showC(), 3))

                    self.show_data41_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_active_power_showALL()/1000, 4))
                    self.show_data42_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_reactive_power_showALL()/1000, 4))
                    self.show_data45_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showALL(), 2))
                    self.show_data46_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_all_active_power_electricity_showALL1(), 2))
                    self.show_data47_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showSTRUCT1(), 2))
                    self.show_data48_Label.set(
                        self.num_format_str(diabbiao_object.dianbiao_quadrant_reactive_power_electricity_showSTRUCT2(), 2))
                    #self.show_data49_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_quadrant3_all_reactive_power_electricity_showALL(), 4))
                    #self.show_data4a_Label.set(
                    #    self.num_format_str(diabbiao_object.dianbiao_quadrant4_all_reactive_power_electricity_showALL(), 4))

            else:
                self.show_Entry.set("")
        else:
            self.show_biao_Label_flag = 0
            #self.show_biao_Label.configure(bg="red")
            self.show_biao_Label.itemconfigure('green', fill='green')
        self.root.after(1000, self.dianbiao_data_show_func)
    def dianbiao_data_show_start_function(self):
        if self.dianbiao_object_run_flag:
            self.show_thread_flag=1
    def dianbiao_data_show_stop_function(self):
        self.show_thread_flag=0
    ######################################显示的UI##################################################################
    def dianbiao_show_config(self, column_tmp, row_tmp, mainframe,mainframe2,
                             show_address_Entry,show_time_Label,show_feilv_Label,
                             #show_data11_Label,show_data12_Label,
                             #show_data13_Label, show_data14_Label,
                             #show_data15_Label, show_data16_Label,
                             #show_data21_Label,show_data22_Label,
                             #show_data23_Label, show_data24_Label,
                             #show_data25_Label, show_data26_Label,
                             show_data31_Label, show_data32_Label,
                             show_data33_Label, show_data34_Label,
                             show_data35_Label, show_data36_Label,
                             show_data41_Label,show_data42_Label,show_data45_Label,show_data46_Label,
                             show_data47_Label, show_data48_Label,
                             # show_data49_Label,show_data4a_Label,
                             ):
        width_tmp=18
        ttk.Label(mainframe2, text="时间", width=4).grid(column=column_tmp + 1, row=row_tmp + 0, sticky=E)
        ttk.Label(mainframe2, width=18, textvariable=show_time_Label).grid(column=column_tmp + 2, row=row_tmp +0 ,
                                                                                 sticky=W)
        self.show_biao_Label = Canvas(self.mainframe2, width=85, height=25)
        self.show_biao_Label.create_oval(5, 5, 20, 20, fill="green", tags=('green'))
        self.show_biao_Label.grid(column=column_tmp + 3, row=row_tmp + 0, sticky=W)

        ttk.Label(mainframe2, width=8, text="当前时段 :").grid(column=column_tmp + 4, row=row_tmp + 0, sticky=E)
        ttk.Label(mainframe2, width=width_tmp, textvariable=show_feilv_Label).grid(column=column_tmp + 5,
                                                                                  row=row_tmp + 0, sticky=W)

        ######################################################################################
        ttk.Label(mainframe, text="电表地址",width=width_tmp).grid(column=column_tmp + 1, row=row_tmp + 1, sticky=E)

        self.show_entry_tk=ttk.Entry(mainframe, width=width_tmp, textvariable=show_address_Entry)
        self.show_entry_tk.grid(column=column_tmp + 2, row=row_tmp + 1, sticky=W)
        self.show_entry_tk.bind('<FocusOut>', self.dianbiao_object_config_address_check)
        self.show_entry_tk.bind("<Button-3>", self.mouse_popup_main)
        ttk.Button(mainframe, text="开始显示", command=self.dianbiao_data_show_start_function).grid(column=column_tmp + 3,
                                                                                                row=row_tmp + 1,
                                                                                                sticky=W)
        ttk.Button(mainframe, text="停止显示", command=self.dianbiao_data_show_stop_function).grid(column=column_tmp + 4,
                                                                                               row=row_tmp + 1,
                                                                                               sticky=W)

        ##################################################################################################################
        ttk.Label(mainframe, width=width_tmp, text="标识码").grid(column=column_tmp + 1, row=row_tmp + 5, sticky=E)
        ttk.Label(mainframe, width=width_tmp, text="名称").grid(column=column_tmp + 2, row=row_tmp + 5, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="数据").grid(column=column_tmp + 3, row=row_tmp + 5, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="单位").grid(column=column_tmp + 4, row=row_tmp + 5, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="02 01 01 00").grid(column=column_tmp + 1, row=row_tmp + 7, sticky=W)
        ttk.Label(mainframe,width=width_tmp, text="A相电压").grid(column=column_tmp + 2, row=row_tmp + 7,sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data31_Label).grid(column=column_tmp + 3,row=row_tmp + 7, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="V").grid(column=column_tmp + 4, row=row_tmp + 7, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="02 01 02 00").grid(column=column_tmp + 1, row=row_tmp + 8, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="B相电压").grid(column=column_tmp + 2, row=row_tmp + 8, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data33_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 8, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="V").grid(column=column_tmp + 4, row=row_tmp + 8, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="02 01 03 00").grid(column=column_tmp + 1, row=row_tmp + 9, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="C相电压").grid(column=column_tmp + 2, row=row_tmp + 9, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data35_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 9, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="V").grid(column=column_tmp + 4, row=row_tmp + 9, sticky=W)
################################################################################################################
        ttk.Label(mainframe, width=width_tmp, text="02 02 01 00").grid(column=column_tmp + 1, row=row_tmp + 10, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="A相电流").grid(column=column_tmp + 2, row=row_tmp + 10, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data32_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 10, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="A").grid(column=column_tmp + 4, row=row_tmp + 10, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="02 02 02 00").grid(column=column_tmp + 1, row=row_tmp + 11,
                                                                       sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="B相电流").grid(column=column_tmp + 2, row=row_tmp + 11, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data34_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 11, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="A").grid(column=column_tmp + 4, row=row_tmp + 11, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="02 02 03 00").grid(column=column_tmp + 1, row=row_tmp + 12,
                                                                       sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="C相电流").grid(column=column_tmp + 2, row=row_tmp + 12, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data36_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 12, sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="A").grid(column=column_tmp + 4, row=row_tmp + 12, sticky=W)



        #ttk.Label(mainframe, width=width_tmp, text="").grid(column=column_tmp + 1, row=row_tmp + 13, sticky=W)


        #ttk.Label(mainframe, width=width_tmp, text="01 01 06 05").grid(column=column_tmp + 1, row=row_tmp + 5, sticky=W)
        #ttk.Label(mainframe,width=width_tmp, text="上一日正向有功电能").grid(column=column_tmp + 2, row=row_tmp + 5,sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kWh").grid(column=column_tmp + 3, row=row_tmp + 5,sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data11_Label).grid(column=column_tmp + 4,row=row_tmp + 5, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="01 02 06 05").grid(column=column_tmp + 1, row=row_tmp + 6, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上一日反向有功电能").grid(column=column_tmp + 2, row=row_tmp + 6,sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kWh").grid(column=column_tmp +3, row=row_tmp + 6,sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data12_Label).grid(column=column_tmp + 4,row=row_tmp + 6, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="01 05 06 05").grid(column=column_tmp + 1, row=row_tmp + 7, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上一日一象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 7, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 7, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data13_Label).grid(column=column_tmp + 4,row=row_tmp + 7, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="01 06 06 05").grid(column=column_tmp + 1, row=row_tmp + 8, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上一日二象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 8, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 8, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data14_Label).grid(column=column_tmp + 4,row=row_tmp + 8, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="01 07 06 05").grid(column=column_tmp + 1, row=row_tmp + 9, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上一日三象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 9, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 9, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data15_Label).grid(column=column_tmp + 4,row=row_tmp + 9, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="01 08 06 05").grid(column=column_tmp + 1, row=row_tmp + 10, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上一日四象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 10, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 10, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data16_Label).grid(column=column_tmp + 4,row=row_tmp + 10, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="02 01 06 05").grid(column=column_tmp + 1, row=row_tmp + 11, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上二日正向有功电能").grid(column=column_tmp + 2, row=row_tmp + 11, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kWh").grid(column=column_tmp + 3, row=row_tmp + 11, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data21_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 11, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="02 02 06 05").grid(column=column_tmp + 1, row=row_tmp + 12, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上二日反向有功电能").grid(column=column_tmp + 2, row=row_tmp + 12, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kWh").grid(column=column_tmp + 3, row=row_tmp + 12, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data22_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 12, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="02 05 06 05").grid(column=column_tmp + 1, row=row_tmp + 13, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上二日一象限无功电能").grid(column=column_tmp + 2, row=row_tmp +13, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 13, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data23_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 13, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="02 06 06 05").grid(column=column_tmp + 1, row=row_tmp + 14, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上二日二象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 14, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 14, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data24_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 14, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="02 07 06 05").grid(column=column_tmp + 1, row=row_tmp + 15, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上二日三象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 15, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 15, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data25_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 15, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="02 08 06 05").grid(column=column_tmp + 1, row=row_tmp + 16, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="上二日四象限无功电能").grid(column=column_tmp + 2, row=row_tmp + 16, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 3, row=row_tmp + 16, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data26_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 16, sticky=W)


        ttk.Label(mainframe, width=width_tmp, text="02 03 00 00").grid(column=column_tmp + 1, row=row_tmp + 17,
                                                                sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="有功功率").grid(column=column_tmp + 2, row=row_tmp + 17,
                                                                       sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="kW").grid(column=column_tmp + 4, row=row_tmp + 17, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data41_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 17, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="02 04 00 00").grid(column=column_tmp + 1, row=row_tmp + 18,
                                                                sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="无功功率").grid(column=column_tmp + 2, row=row_tmp + 18,
                                                                sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="kvar").grid(column=column_tmp + 4, row=row_tmp + 18, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data42_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 18, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="00 01 00 00").grid(column=column_tmp + 1, row=row_tmp + 19,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="总正向有功电量").grid(column=column_tmp + 2, row=row_tmp + 19,
                                                                sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="kWh").grid(column=column_tmp + 4, row=row_tmp + 19, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data45_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 19, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="00 02 00 00").grid(column=column_tmp + 1, row=row_tmp + 20,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="总反向有功电量").grid(column=column_tmp + 2, row=row_tmp + 20,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="kWh").grid(column=column_tmp + 4, row=row_tmp + 20, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data46_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 20, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="00 03 00 00").grid(column=column_tmp + 1, row=row_tmp + 21,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="组合无功1总电能").grid(column=column_tmp + 2, row=row_tmp + 21,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 4, row=row_tmp + 21, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data47_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 21, sticky=W)

        ttk.Label(mainframe, width=width_tmp, text="00 04 00 00").grid(column=column_tmp + 1, row=row_tmp + 22,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="组合无功2总电能").grid(column=column_tmp + 2, row=row_tmp + 22,
                                                                   sticky=W)
        ttk.Label(mainframe, width=width_tmp, text="kvarh").grid(column=column_tmp + 4, row=row_tmp + 22, sticky=W)
        ttk.Label(mainframe, width=width_tmp, textvariable=show_data48_Label).grid(column=column_tmp + 3,
                                                                                   row=row_tmp + 22, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="00 00 07 00").grid(column=column_tmp + 1, row=row_tmp + 23,
        #                                                           sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="总三象限无功电量").grid(column=column_tmp + 2, row=row_tmp + 23,
        #                                                           sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvar").grid(column=column_tmp + 3, row=row_tmp + 23, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data49_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 23, sticky=W)

        #ttk.Label(mainframe, width=width_tmp, text="00 00 08 00").grid(column=column_tmp + 1, row=row_tmp + 24,
        #                                                           sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="总四象限无功电量").grid(column=column_tmp + 2, row=row_tmp + 24,
        #                                                           sticky=W)
        #ttk.Label(mainframe, width=width_tmp, text="kvar").grid(column=column_tmp + 3, row=row_tmp + 24, sticky=W)
        #ttk.Label(mainframe, width=width_tmp, textvariable=show_data4a_Label).grid(column=column_tmp + 4,
        #                                                                           row=row_tmp + 24, sticky=W)
    ##################################串口的配置##########################################################################
    def dianbiao_serial1_button_function(self):
        index=0
        if(self.serial_button_list[index]["text"]==u"打开"):
            if (self.serial_port_list[index]== None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index]=self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"

    def dianbiao_serial2_button_function(self):
        index = 1
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"

    def dianbiao_serial3_button_function(self):
        index = 2
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"

    def dianbiao_serial4_button_function(self):
        index = 3
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"

    def dianbiao_serial5_button_function(self):
        index = 4
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"

    def dianbiao_serial6_button_function(self):
        index = 5
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"

    def dianbiao_serial7_button_function(self):
        index = 6
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial8_button_function(self):
        index = 7
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial9_button_function(self):
        index = 8
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial10_button_function(self):
        index = 9
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial11_button_function(self):
        index = 10
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial12_button_function(self):
        index = 11
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial13_button_function(self):
        index = 12
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial14_button_function(self):
        index = 13
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial15_button_function(self):
        index = 14
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"
    def dianbiao_serial16_button_function(self):
        index = 15
        if (self.serial_button_list[index]["text"] == u"打开"):
            if (self.serial_port_list[index] == None):
                if (len(self.serial_Combobox_list[index].get())):
                    serial_tmp = serial_one_port_object(self.serial_Combobox_list[index].get(), 2400)
                    if (serial_tmp.check_serial_port() != None):
                        self.serial_port_list_string[index] = self.serial_Combobox_list[index].get()
                        self.serial_port_list[index] = serial_tmp
                        self.serial_Labe_list[index].configure(bg="green")
                        self.serial_button_list[index]["text"] = u"关闭"
                    else:
                        messagebox.showerror("提示", "串口打开失败")
        else:
            if (self.serial_port_list[index] != None):
                self.serial_port_list[index].check_serial_port_close()
                self.serial_port_list[index] = None
                self.serial_Labe_list[index].configure(bg="red")
                self.serial_button_list[index]["text"] = u"打开"


    #######################################################
    def dianbiao_serial_get_port_function(self,event):
        event.widget['value'] = tuple(serial_get_all_port())

    def dianbiao_serial_config(self,column_tmp, row_tmp, mainframe,serial_Labe_list,serial_Combobox_list,
                               serial_function_list,serial_button_list):
        for i in range(16):
            if(self.serial_port_list[i]==None):
                serial_Labe_list.append(Label(mainframe, text="串口号",bg="red"))
            else:
                serial_Labe_list.append(Label(mainframe, text="串口号", bg="green"))
            serial_Labe_list[i].grid(column=column_tmp , row=row_tmp+i , sticky=W)
        for i in range(16):
            serial_Combobox_list.append(ttk.Combobox(mainframe, width=6))
            serial_Combobox_list[i].grid(column=column_tmp + 1, row=row_tmp+i , sticky=W)
            serial_Combobox_list[i]['value'] = tuple(serial_get_all_port())
            #serial_Combobox_list[i].bind("<<ComboboxSelected>>", self.dianbiao_serial_get_port_function)#combobox 选择了一个
            serial_Combobox_list[i].bind('<Button-1>', self.dianbiao_serial_get_port_function) # 鼠标左键按下
            if (self.serial_port_list[i] != None):
                serial_Combobox_list[i].set(self.serial_port_list_string[i])
        for i in range(16):
            if (self.serial_port_list[i] == None):
                serial_button_list.append(ttk.Button(mainframe, text="打开", command=serial_function_list[i]))
            else:
                serial_button_list.append(ttk.Button(mainframe, text="关闭", command=serial_function_list[i]))
            serial_button_list[i].grid(
                column=column_tmp + 2,
                row=row_tmp + i, sticky=W)

    def dianbiao_serial_thread_function(self,num):
        serial_port_num=num

        while 1:
            if self.serial_port_list[serial_port_num]==None:
                time.sleep(1)
            else:
                try:

                    if(self.serial_port_list[serial_port_num]!=None):
                        list_tmp = self.serial_port_list[serial_port_num].serial_data_read_all()
                    else:
                        continue
                    if (len(list_tmp)):
                        list_tmp = connect_protocol_645().connect_data_check(list_tmp)#得到一包数据
                        if (len(list_tmp)):
                            address_tmp=int(connect_protocol_645().connect_data_get_address(list_tmp))#返回一个16进制的字符串来表示地址，被int后的值
                            diabbiao_object = self.dianbiao_find_object(address_tmp)
                            if(diabbiao_object!=None):
                                list_tmp = connect_protocol_645().connect_data_analyze(list_tmp, diabbiao_object)
                                if (self.serial_port_list[serial_port_num] != None):
                                    list_tmp = self.serial_port_list[serial_port_num].hextostr(list_tmp)
                                else:
                                    break

                                if (len(list_tmp)):
                                    if (self.serial_port_list[serial_port_num] != None):
                                        self.serial_port_list[serial_port_num].serial_data_write(list_tmp)
                                    else:
                                        break


                except:
                    self.serial_port_list[serial_port_num].check_serial_port_close()
                    self.serial_port_list[serial_port_num]=None
    ###################################ui界面配置的读写####################################
    def dianbiao_data_config_read(self,filename = "ui_config.json"):
        dict_tmp=None
        try:
            with open(filename, "r") as f:
                data_tmp = f.read()
                f.close()
            dict_tmp=eval(data_tmp)
            if(type({})==type(dict_tmp)):
                self.config_data = dict(self.config_data.items() + dict_tmp.items())
                print(self.config_data)
        except :
            pass


    def dianbiao_data_config_write(self,filename = "ui_config.json"):
        config_data={}
        try:
            with open(filename, "w") as f:
                if(self.all_num1_stringvar!=None):
                    config_data["one_one_num"]=self.all_num1_stringvar.get()
                    config_data["one_one_address"] =self.address_start1_stringvar.get()
                if (self.all_num2_stringvar != None):
                    config_data["tree_tree_num"] =self.all_num2_stringvar.get()
                    config_data["tree_tree_address"] =self.address_start2_stringvar.get()
                if (self.all_num3_stringvar != None):
                    config_data["tree_four_num"] =self.all_num3_stringvar.get()
                    config_data["tree_four_address"] =self.address_start3_stringvar.get()
                if (self.cold_data_combox != None):
                    config_data["cold_way"] =self.cold_data_combox.get()
                    config_data["cold_way_data"] =self.cold_data.get()
                if (self.feilv_Entry_list != None):
                    for i in range(14):
                        config_data["feilv_time_"+str(i+1)] =self.feilv_Entry_list[i].get()
                        config_data["feilv_time_"+str(i+1)+"_way"] =self.feilv_Combobox_list[i].get()
                if(self.dianbiao_object_pwd_stringvar!=None):
                    config_data["object_pwd"] = self.dianbiao_object_pwd_stringvar.get()
                if (self.dianbiao_feilv_pwd_stringvar != None):
                    config_data["feilv_pwd"] = self.dianbiao_feilv_pwd_stringvar.get()
                if (self.dianbiao_cold_pwd_stringvar != None):
                    config_data["cold_pwd"] = self.dianbiao_cold_pwd_stringvar.get()
                f.write(str(config_data))
                f.close()
        except:
            pass
    def dianbiao_data_config_write_save_buttun(self,filename = "ui_config.json"):
        config_data={}
        try:
            with open(filename, "w") as f:
                if(self.all_num1_stringvar!=None):
                    config_data["one_one_num"]=self.all_num1_stringvar.get()
                    config_data["one_one_address"] =self.address_start1_stringvar.get()
                if (self.all_num2_stringvar != None):
                    config_data["tree_tree_num"] =self.all_num2_stringvar.get()
                    config_data["tree_tree_address"] =self.address_start2_stringvar.get()
                if (self.all_num3_stringvar != None):
                    config_data["tree_four_num"] =self.all_num3_stringvar.get()
                    config_data["tree_four_address"] =self.address_start3_stringvar.get()
                if (self.cold_data_combox != None):
                    config_data["cold_way"] =self.cold_data_combox.get()
                    config_data["cold_way_data"] =self.cold_data.get()
                if (self.feilv_Entry_list != None):
                    for i in range(14):
                        config_data["feilv_time_"+str(i+1)] =self.feilv_Entry_list[i].get()
                        config_data["feilv_time_"+str(i+1)+"_way"] =self.feilv_Combobox_list[i].get()
                if(self.dianbiao_object_pwd_stringvar!=None):
                    config_data["object_pwd"] = self.dianbiao_object_pwd_stringvar.get()
                if (self.dianbiao_feilv_pwd_stringvar != None):
                    config_data["feilv_pwd"] = self.dianbiao_feilv_pwd_stringvar.get()
                if (self.dianbiao_cold_pwd_stringvar != None):
                    config_data["cold_pwd"] = self.dianbiao_cold_pwd_stringvar.get()
                f.write(str(config_data))
                f.close()
                messagebox.showinfo("提示", "保存成功")
        except:
            messagebox.showerror("提示", "保存失败")
    ####################################两个运行按键的操作函数##########################################################
    def dianbiao_object_start_button_function(self):
        self.config_data={}
        if(len(self.dianbiao_object_pwd_stringvar.get())):
            self.dianbiao_data_config_read(self.dianbiao_object_pwd_stringvar.get())
            if (len(self.config_data["feilv_pwd"])):
                self.dianbiao_data_config_read(self.config_data["feilv_pwd"])
                self.dianbiao_object_run_flag=1
                #运行逻辑处理
                self.dianbiao_object_run()
                messagebox.showinfo("提示", "开始运行")
        else:
            messagebox.showinfo("提示", "参数不全")

    def dianbiao_object_stop_button_function(self):
        self.dianbiao_object_run_flag=0
        messagebox.showinfo("提示", "停止运行")

    ##########################################三类电表的运行线程####################################################
    def dianbiao_object_run(self):
        if len(self.one_one_switch_object_list):
            del(self.one_one_switch_object_list)
            self.one_one_switch_object_list=[]
            if(self.one_one_thread.isAlive()):
                threading.Thread._Thread__stop(self.one_one_thread)
            del (self.one_one_thread)
            self.one_one_thread = None
        try:
            mun_tmp=int(self.config_data["one_one_num"])
            mun_address_tmp=int(self.config_data["one_one_address"])
        except:
            return
        for i in range(mun_tmp):
            self.one_one_switch_object_list.append(dianbiao_logic.one_one_meter(str(mun_address_tmp+i),
                                                                          16,self.config_data))
        if len(self.one_one_switch_object_list):
            self.one_one_thread = threading.Thread(target=self.one_one_thread_fun, args=(mun_tmp,60))
            self.one_one_thread.daemon = True
            self.one_one_thread.start()

        if len(self.tree_tree_switch_object_list):
            del(self.tree_tree_switch_object_list)
            self.tree_tree_switch_object_list=[]
            if (self.tree_tree_thread.isAlive()):
                threading.Thread._Thread__stop(self.tree_tree_thread)
            del (self.tree_tree_thread)
            self.tree_tree_thread = None
        try:
            mun_tmp = int(self.config_data["tree_tree_num"])
            mun_address_tmp = int(self.config_data["tree_tree_address"])
        except:
            return
        for i in range(mun_tmp):
            self.tree_tree_switch_object_list.append(dianbiao_logic.tree_tree_meter(str(mun_address_tmp + i),
                                                                            16, self.config_data))
        if len(self.tree_tree_switch_object_list):
            self.tree_tree_thread = threading.Thread(target=self.tree_tree_thread_fun, args=(mun_tmp, 60))
            self.tree_tree_thread.daemon = True
            self.tree_tree_thread.start()

        if len(self.tree_four_switch_object_list):
            del(self.tree_four_switch_object_list)
            self.tree_four_switch_object_list=[]
            if (self.tree_four_thread.isAlive()):
                threading.Thread._Thread__stop(self.tree_four_thread)
            del (self.tree_four_thread)
            self.tree_four_thread = None
        try:
            mun_tmp = int(self.config_data["tree_four_num"])
            mun_address_tmp = int(self.config_data["tree_four_address"])
        except:
            return
        for i in range(mun_tmp):
            self.tree_four_switch_object_list.append(dianbiao_logic.tree_four_meter(str(mun_address_tmp + i),
                                                                            16, self.config_data))
        if len(self.tree_four_switch_object_list):
            self.tree_four_thread = threading.Thread(target=self.tree_four_thread_fun, args=(mun_tmp, 60))
            self.tree_four_thread.daemon = True
            self.tree_four_thread.start()

    def one_one_thread_fun(self,len_tmp,time_tmp):

        while 1:
            timestamp_tmp = int(time.time())
            try:
                if(self.dianbiao_object_run_flag):
                    for i in range(len_tmp):
                        self.one_one_switch_object_list[i].calculate_powers(time_tmp)
                timestamp_tmp2=int(time.time())-timestamp_tmp
                timestamp_tmp3=time_tmp-timestamp_tmp2
                time.sleep(timestamp_tmp3)
            except:
                time.sleep(1)
    def tree_tree_thread_fun(self,len_tmp,time_tmp):
        while 1:
            timestamp_tmp = int(time.time())
            try:
                if(self.dianbiao_object_run_flag):

                    for i in range(len_tmp):
                        self.tree_tree_switch_object_list[i].calculate_powers(time_tmp)
                timestamp_tmp2 = int(time.time()) - timestamp_tmp
                timestamp_tmp3 = time_tmp - timestamp_tmp2
                time.sleep(timestamp_tmp3)
            except:
                time.sleep(1)
    def tree_four_thread_fun(self,len_tmp,time_tmp):
        while 1:
            timestamp_tmp = int(time.time())
            try:
                if(self.dianbiao_object_run_flag):
                    for i in range(len_tmp):
                        self.tree_four_switch_object_list[i].calculate_powers(time_tmp)
                timestamp_tmp2 = int(time.time()) - timestamp_tmp
                timestamp_tmp3 = time_tmp - timestamp_tmp2
                time.sleep(timestamp_tmp3)
            except:
                time.sleep(1)

    ################################UI 界面运行开始#####################################################################
    def ui_runing(self):
        self.root.after(1000,self.dianbiao_data_show_func)
        self.root.mainloop()

if __name__ == "__main__":
    try:
        Dianbiao_view().ui_runing()
    except:
        a = traceback.format_exc(limit=10)
        with open("last.log", "a") as f:
            f.write((a))
            f.close()